From MiniScript Wiki
Jump to navigation Jump to search

string is one of the core data types in MiniScript.

Strings in MiniScript are immutable. Because of this operations which would modify the string return a new one instead.


Method Description
len Returns the length of the string
indexOf(substring) Returns the index of the first occurrence of substring in the string, or null if not found
remove(substring) Returns a new string with the first occurrence of substring removed
insert(index, otherString) Returns a new string with otherString inserted at index
replace(substring, otherString, maxCount) Returns a new list replacing occurrences of substring with otherString at most maxCount, if specified. If maxCount is omitted it replaces all occurrences.
split(separator) Splits the string by a separator substring, returning a list of the split parts
lower Returns a new string with all letter converted to lowercase
upper Returns a new string with all letter converted to uppercase
code Returns the numeric code of the first character of the string
val Returns the numeric value represented by the string; returns 0 if the conversion is not possible
indexes Returns a list with the indexes of the characters of the string
hasIndex(index) Returns 1 (true) if the requested index is among the string's indexes, 0 otherwise
values Returns a list with each individual character that make up the string

See also

This article is a stub. You can help the MiniScript Wiki by expanding it.