How to add spaces in between characters in a char array without using builtin fuctions

Input- "java"

output-" j a v a"

That is inserting a space in between two characters in a char array

In a char array without using any built in functions like append. if possible provide the code also

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Anoop Kumar

    Anoop Kumar

    @anoop-SlERLg Mar 14, 2019

    I will give you logic

    //------------------ 
    ... 
    For  int i = 0  to inputString.Length -1 
        If i == 0
            print inputString.charAt(i)
        Else 
            Print <space>
            Print inputString.charAt(i)
        End If
    End For loop
    ... 
    //------------------ 


  • Harsha Swamy

    Harsha Swamy

    @harsha-7EB6cz Mar 14, 2019

    no bro doesn't work 

  • Anoop Kumar

    Anoop Kumar

    @anoop-SlERLg Mar 14, 2019

    Give your code please ! 

    I don't see any issue with the logic. I created a code snippet and it works fine.

  • Harsha Swamy

    Harsha Swamy

    @harsha-7EB6cz Mar 14, 2019

    My bad it actually worked thanks Anoop....