- Home /
String Into Seperate characters problem
Hello people, having problems with getting a string into an array and could do with some help...i have a string of names seperated by comma's which i passed into a split method and the code i used works fine, but then when i try and pass the split name into another split function to get the seperate characters using the same method i get an index out of range message. the code i am using is this : -
function ConvertTunesChar(splitter : String){
Debug.Log(splitter);
var tuneChar = new Array();
tuneChar = splitter.Split(""[0]);
for(i = 0; i < tuneChar.Length; i++){
print(tuneChar[i]);
}
}
Splitter been the array string i placed the string with seperated with comma's into in another function using the exact same split approach but the split was using (","[0]) instead of (""[0]) and it worked fine..any help please ?.
Answer by DaveA · Dec 01, 2011 at 08:07 PM
splitter.Split(","[0]);
you were missing the comma
Thanks but now i just get a null referencr exception object reference not set to an instance of an object message even though the debug on splitter is showintg up as the string from the other split array.
Your answer
Follow this Question
Related Questions
How to split a string using unity flash player? 0 Answers
The method Resources.Load does not accept strings after splitting. 0 Answers
Parse String and Serialise 1 Answer
String.Split With Backslash 2 Answers