How to insert space between each characters given by user

For each item entered by the user, I want to print with space between characters

for example - Bangalore

the output should be -
b a n g a l o r e

Hi,

Can you try the following expression?

String.Join("",yourString.Select(Function(c) c+" ")).Trim

Regards,

2 Likes

thankyou so much, it worked. can you please explain me the code as well.

Another way to do it is to use ToList(). It splits the string to a list of chars that you then can join to a string with a space in between them.

String.Join(" ", str.ToList)

image

1 Like

thankyou

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.