Tells whether a text contains a search text.
Example: 'hello world' includes 'world' -> true
The text and what to look for
True when the search text occurs in it
Tells whether a text begins with a search text.
Example: 'hello world' starts with 'hello' -> true
The text and what to look for at its start
True when the text begins with it
Tells whether a text ends with a search text.
Example: 'hello world' ends with 'world' -> true
The text and what to look for at its end
True when the text ends with it
Finds where a search text first occurs, counting characters from 0, or -1 when it does not occur.
Example: 'hello world' finding 'world' -> 6
The text and what to look for
The position of the first occurrence, or -1
Finds where a search text last occurs, counting characters from 0, or -1 when it does not occur.
Example: 'hello world hello' finding 'hello' -> 12
The text and what to look for
The position of the last occurrence, or -1
Reads the character at a position, counting from 0.
Example: 'hello' at 1 -> 'e'
The text and the position
The character, or an empty text when the position is outside the text
Tells whether a regular expression matches somewhere in a text.
Example: 'hello123' against '[0-9]+' -> true
The text, the pattern and the flags
True when the pattern matches
Finds the parts of a text that a regular expression matches.
With the g flag every match is listed; without it only the first match and its capture
groups. No match gives null.
Example: 'hello123world456' against '[0-9]+' with 'g' -> ['123', '456']
The text, the pattern and the flags
The matches, or null when there are none
Replaces what a regular expression matches with another text.
With the g flag every match is replaced; without it only the first.
Example: 'hello123world456' against '[0-9]+' with 'g', replaced by 'X' -> 'helloXworldX'
The text, the pattern, the flags and the replacement
The text with the replacements made
Finds where a regular expression first matches, counting characters from 0, or -1 when it does not match.
Example: 'hello123' against '[0-9]+' -> 5
The text, the pattern and the flags
The position of the first match, or -1
Cuts a text into pieces wherever a regular expression matches; the matches themselves are dropped.
Example: 'a1b2c3' split by '[0-9]+' -> ['a', 'b', 'c', '']
The text, the pattern and the flags
The pieces, in order
Cuts a text into pieces wherever a separator occurs; the separator itself is dropped.
Example: 'apple,banana,cherry' split by ',' -> ['apple', 'banana', 'cherry']
The text and the separator
The pieces, in order
Replaces every occurrence of a search text with another text.
Example: 'hello hello' replacing 'hello' with 'hi' -> 'hi hi'
The text, what to search for and what to put in its place
The text with the replacements made
Joins a list of texts into one, with a separator between neighbors.
Example: ['apple', 'banana', 'cherry'] joined by ', ' -> 'apple, banana, cherry'
The texts and the separator
The joined text
Turns any value into text, the way JavaScript prints it.
Example: 42 -> '42', [1, 2] -> '1,2'
The value
The value as text
Turns every item of a list into text, the way JavaScript prints it.
Example: [1, 2.5, true] -> ['1', '2.5', 'true']
The list of values
One text per item, in order
Fills numbered placeholders in a text with values: {0} takes the first value, {1} the
second, and so on.
A placeholder without a value is left as it is. Example: 'Point: ({0}, {1})' with [10, 5] -> 'Point: (10, 5)'
The text with placeholders and the values to fill in
The filled-in text
Takes the characters from a start position up to, but not including, an end position.
A start larger than the end swaps the two, and negative positions count as 0. Example: 'hello world' from 0 to 5 -> 'hello'
The text and the start and end positions
The characters in that range
Takes the characters from a start position up to, but not including, an end position.
Unlike substring, a negative position counts from the end of the text.
Example: 'hello world' from 0 to 5 -> 'hello'; from -5 -> 'world'
The text and the start and end positions
The characters in that range
Adds a filler text in front until the text reaches a length; a text already that long is left alone.
Example: 'x' to length 3 with 'a' -> 'aax'
The text, the length to reach and the filler
The padded text
Adds a filler text behind until the text reaches a length; a text already that long is left alone.
Example: 'x' to length 3 with 'a' -> 'xaa'
The text, the length to reach and the filler
The padded text
Repeats a text a number of times, end to end.
Example: 'ha' three times -> 'hahaha'
The text and how many times to repeat it
The repeated text
Joins several texts into one with nothing between them.
Example: ['hello', ' ', 'world'] -> 'hello world'
The texts to join
The joined text
Draws one character as line paths with a simple stroke font.
The paths lie flat on the XZ plane, scaled so the character is height tall, and are
returned with the character's width and height. An unknown character is drawn as a question
mark.
Example: 'A' at height 10 -> the strokes of an A, 10 units tall
The character, its height and its offsets
The character's width, height and stroke paths as lists of points
Draws a text, with line breaks, as line paths with a simple stroke font.
Each line comes back as its characters with their paths, laid out flat on the XZ plane with
the given height, spacing and alignment; centerOnOrigin puts the middle of the block at the
origin.
Example: 'Hello' at height 10 -> five characters with their strokes
The text and how to lay it out
One entry per line, each with its characters and their stroke paths
Working with text: splitting, joining, searching, trimming, padding, changing case, regular expressions and formatting with placeholders.
vectorCharandvectorTextturn text into line paths drawn with a simple stroke font, so words can become geometry. Positions in text count from 0.