# Adding values to a string

So I have the following string:

y={"110001011111011001000010", "00001010001000100111", \
"11000011011100111110", "110011101001010110110", \
"1001010011100001010001000", "01111111001100010111", \
"10010111111001110111111", "01111100001011001100", \
"00101111000111111111101", "0001011011011101010100", \
"01010110110110000010", "110011111010011100111", \
"11101101001100101100", "10110010101100000000", \
"0010111100011011110111111", "0001011011011001001100", \
"00111100001100111110", "10111111101101010110110", \
"10110011111101010110110", "00111011001000101010", \
"0100111110001110111100", "110101101100001110000001", \
"011000100011001100001010001000", "000000101001100010111", \
"11111101011100111111", "10101111001111000010", \
"110111001101110000001000110011", "000000110101100010100", \
"01010111100001011011011", "11001110110001011110001", \
"10001100100000101101100", "000111000101111101000000", \
"1000101011000001010001000", "01010110101100010111", \
"1100110010010101001011011", "00001010101000010000", \
"010000011100001010001000", "1010111010101100010111", \
"100101001110001110001011", "01111111001000110010"}


What I am trying to is add a "0." at the start of every element. I thought about using a For loop to do this. But is there another way?

• Which String function, if any, have you tried so far?
– Syed
Apr 7 at 15:05
• I am trying to use StringReplace and StringJoin, but i am not sure if it is appropiate. I did this For[i = 1, i <= Length[y], i++, y[[i]] = StringReplace[y[[i]], y[[i]] -> StringJoin["0.", y[[i]]]]] but I am not sure if there a more efficient way Apr 7 at 15:11
• "0" <> # & /@ y Apr 7 at 15:23

With your y as defined above:

StringJoin["0", #] & /@ y


adds a zero to the front of each term.

• Or the abbreviated form "0" <> # & /@ y Apr 7 at 16:45

With y taken from the OP

StringInsert[y, "0", 1]