LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

insert space character between every character in a string

Solved!
Go to solution

I have an array of varing length.  Each element in the array contains a string.  I want to put a space character " " between each character of each string in the array.  The length of the string in each element of the array varies.

 

I have played with nested for loops with shift registers and feedback nodes with no success, and started thinking I'm making this too difficult.

 

Thanks,

 

Mike

0 Kudos
Message 1 of 6
(7,922 Views)

Try this

 

AddSpaces.png

0 Kudos
Message 2 of 6
(7,915 Views)

 

Spacer.png  The ASCII code for a space is 32.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 6
(7,911 Views)

Hi KSU,

 

This should do what you are after. No loop is required:

 

Add spaces in string array snippet.png

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 4 of 6
(7,893 Views)
Solution
Accepted by topic author KSU Flyer

(Lucither: Your code will make every other array element an empty string. It does not insert spaces between characters as required.)

 

 

There are some nice solutions already posted above, here's another random one. 😉

 

 

Message Edited by altenbach on 04-16-2010 11:46 PM
Message 5 of 6
(7,881 Views)
Ah, I see. Misunderstood the question. I thought he had an array of strings and wanted to insert a space in between each string. Sorry Smiley Sad
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 6 of 6
(7,878 Views)