This is how to split string in Unityscript from Unity Wiki. However, I don't recognize " "[0]
. Is this regular expression? If so, any reference to it? I'm familiar with regular expressions generally and used them a lot, but this syntax is little confusing.
var qualifiedName = "System.Integer myInt";
var name = qualifiedName.Split(" "[0]);
As many have already mentioned, " "[0]
is the first character of the " "
string (which is a System.String
, or an array of System.Char
s. The problem with UnityScript is that ' '
is interpreted as a String too, so the only way to provide a Char is by slicing.