i have two strings String s1,s2 and i want to copy the odd place characters of s1 into s2, how?
s1="ARDUINO UNO"; //input
s2="RUN N"; //required output
i have two strings String s1,s2 and i want to copy the odd place characters of s1 into s2, how?
s1="ARDUINO UNO"; //input
s2="RUN N"; //required output
Does this give you some clues ?
for (int c = 1; c < s1.length(); c += 2)
{
Serial.print(s1.charAt(c));
}
}
However, why use Strings and not strings ?
Write a for() loop which starts at 1 and increases by 2 until the length of s1 is exceeded. In the loop, extract the contents of s1 at that index and append it to s2.
Paul - don't you just hate it when that happens
PM from the OP
i dont want to print that i want to copy into another string s2.
I gave you some clues but you need to do some work too.
Instead of printing the characters picked from String s1 concatenate them with String s2
Have a look at the String functions available in String object