The following string parsing methods were first introduced in gmax 1.0 and are available in 3ds Max 5 and higher.
Methods:
<Boolean>isSpace <String>
Returns true if the first character of the given string is whitespace (space, tab, or newline), false if not.
EXAMPLE
``` isSpace " MAXScript" --first character is space true isSpace "MAXScript" --first character is not whitespace false isSpace "\nMAXScript" --first character is new line true
```
<String>trimLeft <String> [String trimChars]
Trims all leading characters specified in trimChars from the given string and returns it. If trimChars is not specified, basic whitespace characters (space, tab, and newlines) are trimmed.
EXAMPLE
``` trimleft " \nMAXScript" --space and new line trimmed "MAXScript"
```
<String>trimRight <String> [String trimChars]
Trims all trailing characters specified in trimChars from the given string and returns it. If trimChars is not specified, basic whitespace characters (space, tab, and newlines) are trimmed.
EXAMPLE
``` trimright "MAXScript \n " --spaces and new line trimmed "MAXScript" trimright "\(Teapot0911" "1234567890" --remove trailing numbers "\)Teapot"
```
<String>readToken <CharStream>
Reads a token from the given stream and returns it as a string. Tokens are defined by a sequence of characters broken up by whitespace. Leading whitespace and one line "//" style comments are automatically skipped.
<String>peekToken <CharStream>
Same as readToken except it does not increment the file position.
EXAMPLE
``` a= "token! -- /* comment!\n */ ( ( "nested bracket" pair ) ) " as stringstream (while peekToken a != undefined do print (readToken a);ok)
```
skipSpace <CharStream>
Skips to first non-whitespace from the given stream's current file position.