Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this regular expression?

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]);

Wiki Reference

like image 528
Pablo Avatar asked Dec 11 '22 09:12

Pablo


1 Answers

On any string, wether it is a variable or a literal (" "), you can use an indexer to get the char at the nth position.

Your codesample is a very weird way of literally defining a char with a space, and could be simplified by using this:

' '

note the single quotes instead of double quotes

like image 71
Davy Avatar answered Jan 08 '23 08:01

Davy