Here is my code:
var DataStr=w.data;
Data = DataStr.Split(":");
Ter = Data[0];
Owner = Data[1];
It keeps giving me this error:
Help please?
EDIT: I figured it out String.Split has to be lile this: Data = DataStr.Split(":"[0]);
Here is my code:
var DataStr=w.data;
Data = DataStr.Split(":");
Ter = Data[0];
Owner = Data[1];
It keeps giving me this error:
Help please?
EDIT: I figured it out String.Split has to be lile this: Data = DataStr.Split(":"[0]);
(“:”,[0])
var str : String = "tom.mom.mot";
var arr = new Array();
arr = str.Split(".", [0]);
// arr[0] = tom
// arr[1] = mom
You’re too late!@Tempest ![]()
Wow I figured this out right as you guys posted…
great ![]()
It’s probably clearer syntax if you type it like this:
Data = DataStr.Split(‘:’);
Split is looking for a char, so use the char quotes.
Creative’s and Tempest’s sample code is wrong.
You should write “.”[0].
You must not write comma.
Why?what’s [0]…
it should be
string[] Data = DataStr.Split(':');
The original code (from years ago!) is in Unityscript, so no that won’t work. “:”[0] is correct.
–Eric
My bad, i thought that was c#.
Will pay more attention ![]()