I'm curious as to why you need to do this. Maybe there's a
better way to address the problem. What you want is quite
straight forward using String's length() and toCharArray()
methods. What have you tried so far?
String c = String a + String b;
byte ab = convert String c to byte array;
Now I want to separate byte ab to recover the String a and String b;
How do I do this?
A related question: how do you turn String c back into Strings a and b? What separates the two? If you know this, you can turn byte ab back into String c first, then split that one.
I will tell you this: unless you use a special separator sequence (e.g. |) you won't be able to. If a == "Hello" and b == "World", c will become "HelloWorld". If I need to split that into a and b again, I have "HelloWorld".length() different options:
- "" and "HelloWorld"
- "H" and "elloWorld"
- "HelloWorl" and "d"
- "HelloWorld" and ""