|
I'm trying to get a count of the number of instances of a char in a string. Is there any way to get this to work in Unity's JS?
(comments are locked)
|
|
You'd call IndexOf in a loop. Something like (untested):
(comments are locked)
|

stringToSearch.IndexOf("x") will work in C#, and I think in Javascript.
IndexOf works, as well as LastIndexOf - but I need a total count of the times the char shows up. LastIndexOf - IndexOf was my first thought, but the characters are separated by varying amounts of letters.