- Home /
Split without using a delimiters
Hello, i wonder if there is way to split without using delimiters
for example
public string test = "123A";
how to split this "123A" to get
"1"
"2"
"3"
"A"
Without using any delimiters like "1.2.3.A" or "1/2/3/A"
by the way . the string test is not specific number/word Sorry for my bad English, and Thanks
http://answers.unity3d.com/questions/393726/how-do-you-textsplit-a-string-with-no-delimitersse.html
For uJS, this Linq method was the best
Answer by hamstar · Feb 14, 2014 at 11:11 AM
I'm not sure if this is what you're asking. You can access each character in the string using the [`[]` Operator][1]. Each character in the string is indexed, from 0 to (Length of string) - 1.
string test = "123A";
for (int i = 0; i < test.Length; i++) {
Debug.Log(test[i]); // print character at index 'i' in string
}
This will output what you wrote.
[1]: http://msdn.microsoft.com/en-us/library/a3hd7ste.aspx
Answer by MJHarwood · Feb 14, 2014 at 05:17 PM
You can use Split with an empty string as the delimiter. eg. "123A".Split("") and it will split on character boundaries.
Your answer
![](https://koobas.hobune.stream/wayback/20220613133456im_/https://answers.unity.com/themes/thub/images/avi.jpg)