home, UNITY, updated

Split a string basis of an character

You can easily split a string by using Split function.

string str = "Hello-World";
string[] str_array = str.Split(new string[] { "-" }, System.StringSplitOptions.None);
print(str_array[0]);
print(str_array[1]);

Output : 
Hello
World

Related Articles

post a comment