Module : lang.string

Module Overview

This module provides lang library string operations defined by the language specification 2019R2.

Objects

$anonType$2

Functions

codePointCompare

Lexicographically compare strings using their Unicode code points. This will allow strings to be ordered in a consistent and well-defined way, but the ordering will not typically be consistent with cultural expectations for sorted order.

concat

Concatenate all the strs. Empty string if empty.

endsWith

Returns true if str end with substr.

fromBytes

Convert back to a string from its UTF-8 representation in bytes.

fromCodePointInts

Creates a string from an array of ints representing its code points. Returns an error if any member of codePoints is negative or greater than 0x10FFFF or is a surrogate (i.e. in the range 0xD800 or 0xDFFF inclusive).

getCodePoint

Returns the unicode codepoint at index i.

indexOf

Returns the index of the first occurrence of substr in the part of the str starting at startIndex or nil if it does not occur.

iterator

Returns an iterator over the string The iterator will return the substrings of length 1 in order.

join

Returns a new string composed of strs elements joined together with separator.

length

Returns the length of the string.

startsWith

Returns true if str starts with substr.

substring

Returns a string that is a substring of this string.

toBytes

Represents str as an array of bytes using UTF-8.

toCodePointInts

Returns an array with an int for each code point in str.

toLowerAscii

Return A-Z into a-z and leave other characters unchanged.

toUpperAscii

Return a-z into A-Z and leave other characters unchanged.

trim

Remove ASCII white space characters (0x9...0xD, 0x20) from start and end of str.