String

From MiniScript Wiki
Revision as of 12:01, 6 December 2021 by SebNozzi (talk | contribs) (Added some methods)
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.

Methods

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.
indexes Returns a list with the indexes of the characters of the string
values Returns a list of each character that make up the string

See also


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