string: members
22 implemented, 0 reserved. Entries are sorted by name.
Implemented
Section titled “Implemented”charat
Section titled “charat”string.charat(index: number) -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns the single byte at the given position, or an empty string when the position is outside the text.
echo("abc".charat(1)); // bSpecification: standard-library.md§2.2.
string.ends(suffix: string) -> number
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns 1 when the text ends with suffix, otherwise 0. Capital and small letters count as equal.
echo("Hello".ends("llo")); // 1Specification: standard-library.md§2.2.
escape
Section titled “escape”string.escape() -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Puts a backslash in front of every double quote, single quote, and backslash in the text.
echo("a'b".escape());Specification: standard-library.md§2.2.
length
Section titled “length”string.length() -> number
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns how many bytes the text holds.
echo("abc".length()); // 3Specification: standard-library.md§2.2.
string.lower() -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns the text with ASCII capital letters turned into small ones.
echo("ABC".lower()); // abcSpecification: standard-library.md§2.2.
string.pos(sub: string) -> number
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns the byte offset at which sub first appears in the text, or -1 when it never appears.
echo("Bornescript".pos("script")); // 5Specification: standard-library.md§2.2.
positions
Section titled “positions”string.positions(sub: string) -> array
Runs on: server and client. Origin: compatibility. Since: M8. Playground: yes.
Returns the byte offsets of every place sub appears in the text, overlapping matches included; an empty sub gives an empty array.
echo("abab".positions("ab")); // 0,2Specification: standard-library.md§2.2.
regexfind
Section titled “regexfind”string.regexfind(pattern: string, flags?: string) -> array
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexfind.
temp.m = "id=42".regexfind("\\d+");Specification: standard-library.md§8.1.
regexfindall
Section titled “regexfindall”string.regexfindall(pattern: string, flags?: string) -> array
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexfindall.
temp.all = "a1b22".regexfindall("\\d+");Specification: standard-library.md§8.1.
regexfindpos
Section titled “regexfindpos”string.regexfindpos(pattern: string, flags?: string) -> array
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexfindpos.
temp.at = "hello".regexfindpos("l+");Specification: standard-library.md§8.1.
regexmatch
Section titled “regexmatch”string.regexmatch(pattern: string, flags?: string) -> number
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexmatch: tests this text against the pattern.
echo("abc".regexmatch("b"));Specification: standard-library.md§8.1.
regexreplace
Section titled “regexreplace”string.regexreplace(pattern: string, replacement: string, flags?: string) -> string
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexreplace.
echo("a-b".regexreplace("-", "+"));Specification: standard-library.md§8.1.
regexsplit
Section titled “regexsplit”string.regexsplit(pattern: string, flags?: string) -> array
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regexsplit.
temp.parts = "a,b".regexsplit(",");Specification: standard-library.md§8.1.
regextest
Section titled “regextest”string.regextest(pattern: string, flags?: string) -> number
Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.
Method form of regextest.
echo("abc".regextest("^a"));Specification: standard-library.md§8.1.
savestring
Section titled “savestring”string.savestring(path: string, mode: number) -> number
Runs on: server and client. Origin: engine extension. Since: M4. Playground: no.
Writes the string to a file. Mode 0 replaces the file, mode 1 appends. Returns 1 on success.
"text".savestring("logs/out.txt", 1);Specification: standard-library.md§12.2.
string.split(separator: string) -> array
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns the parts of the text between occurrences of the separator, keeping empty parts.
echo("a,b,,c".split(",").size()); // 4Specification: standard-library.md§17.4.7.
starts
Section titled “starts”string.starts(prefix: string) -> number
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns 1 when the text begins with prefix, otherwise 0. Capital and small letters count as equal.
echo("Hello".starts("he")); // 1Specification: standard-library.md§2.2.
substring
Section titled “substring”string.substring(start: number, length?: number) -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns part of the text starting at start. A missing or negative length takes everything to the end; a negative start counts as 0 and a range past the end is cut.
echo("Bornescript".substring(5, 3)); // scrSpecification: standard-library.md§2.2.
tokenize
Section titled “tokenize”string.tokenize(delims?: string) -> array
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Splits the text into parts at the delimiter bytes (space and comma by default). Spaces and tabs collapse, but every other delimiter ends a part, so two commas in a row give an empty part. A part that starts with a double quote runs to the closing quote and keeps its delimiters.
temp.parts = "a b,c".tokenize();Specification: standard-library.md§2.4.
string.trim() -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Removes spaces, tabs, carriage returns, and line feeds from both ends of the text.
echo(" x ".trim()); // xSpecification: standard-library.md§2.2.
string.type() -> number
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns 0 for numbers, 1 for text, 2 for objects and functions, and 3 for arrays and list strings.
echo(temp.value.type());Specification: standard-library.md§6.1.
string.upper() -> string
Runs on: server and client. Origin: compatibility. Since: M1. Playground: yes.
Returns the text with ASCII small letters turned into capitals.
echo("abc".upper()); // ABCSpecification: standard-library.md§2.2.
Engine version 0.1.0. Built 2026-11-18.