capitalized
import { capitalized } from "std/text"
pub fun capitalized(text: Text): Text
Capitalize the first letter of the given text.
You can check the original tests for code examples:
char_at
import { char_at } from "std/text"
pub fun char_at(text: Text, index: Num): Text
Returns the character from text at the specified index (0-based).
If index is negative, the substring starts from the end of text based on the absolute value of index.
You can check the original tests for code examples:
ends_with
import { ends_with } from "std/text"
pub fun ends_with(text: Text, suffix: Text): Bool
Checks if text ends with a value.
You can check the original tests for code examples:
join
import { join } from "std/text"
pub fun join(list: [Text], delimiter: Text): Text
Merges text using the delimiter specified.
You can check the original tests for code examples:
lowercase
import { lowercase } from "std/text"
pub fun lowercase(text: Text): Text
Makes the text input lowercase using tr.
You can check the original tests for code examples:
lpad
import { lpad } from "std/text"
pub fun lpad(text: Text, pad: Text, length: Num): Text
Pads text with the specified pad character on left until it reaches the desired length.
You can check the original tests for code examples:
match_regex
import { match_regex } from "std/text"
pub fun match_regex(source: Text, search: Text, extended: Bool = false): Bool
Match all occurences of a regex pattern.
Function uses sed
You can check the original tests for code examples:
match_regex_any
import { match_regex_any } from "std/text"
pub fun match_regex_any(text: Text, terms: [Text]): Bool
Checks if an array value (with regular expression) is in the text.
You can check the original tests for code examples:
parse_number
import { parse_number } from "std/text"
pub fun parse_number(text: Text): Num ?
Attempts to parse a given text into a number, returning the parsed number or zero if parsing fails.
You can check the original tests for code examples:
replace
import { replace } from "std/text"
pub fun replace(source, search, replace)
Replaces all occurences of a pattern in the content with the provided replace text.
You can check the original tests for code examples:
replace_one
import { replace_one } from "std/text"
pub fun replace_one(source, search, replace)
Replaces the first occurence of a pattern in the content with the provided replace text.
You can check the original tests for code examples:
replace_regex
import { replace_regex } from "std/text"
pub fun replace_regex(source: Text, search: Text, replace: Text, extended: Bool = false): Text
Replaces all occurences of a regex pattern in the content with the provided replace text.
Function uses sed
You can check the original tests for code examples:
reversed
import { reversed } from "std/text"
pub fun reversed(text: Text): Text
Reverses text using rev.
You can check the original tests for code examples:
rpad
import { rpad } from "std/text"
pub fun rpad(text: Text, pad: Text, length: Num): Text
Pads text with the specified pad character on the right until it reaches the desired length.
You can check the original tests for code examples:
slice
import { slice } from "std/text"
pub fun slice(text: Text, index: Num, length: Num = 0): Text
Returns a substring from text starting at the given index (0-based).
If index is negative, the substring starts from the end of text based on the absolute value of index.
If length is provided, the substring will include length characters; otherwise, it slices to the end of text.
If length is negative, an empty string is returned.
You can check the original tests for code examples:
split
import { split } from "std/text"
pub fun split(text: Text, delimiter: Text): [Text]
Splits the input text into an array of substrings using the specified delimiter.
You can check the original tests for code examples:
split_chars
import { split_chars } from "std/text"
pub fun split_chars(text: Text): [Text]
Splits a text into an array of individual characters.
You can check the original tests for code examples:
split_lines
import { split_lines } from "std/text"
pub fun split_lines(text: Text): [Text]
Splits a text into an array of substrings based on newline characters.
You can check the original tests for code examples:
split_words
import { split_words } from "std/text"
pub fun split_words(text: Text): [Text]
Splits a text into an array of substrings based on space character.
starts_with
import { starts_with } from "std/text"
pub fun starts_with(text: Text, prefix: Text): Bool
Checks if text starts with a value.
You can check the original tests for code examples:
text_contains
import { text_contains } from "std/text"
pub fun text_contains(text: Text, phrase: Text): Bool
Checks if some text contains a value.
You can check the original tests for code examples:
text_contains_all
import { text_contains_all } from "std/text"
pub fun text_contains_all(text: Text, terms: [Text]): Bool
Checks if all the arrays values are in the string
You can check the original tests for code examples:
text_contains_any
import { text_contains_any } from "std/text"
pub fun text_contains_any(text: Text, terms: [Text]): Bool
Checks if an array value is in the text.
You can check the original tests for code examples:
trim
import { trim } from "std/text"
pub fun trim(text: Text): Text
Trims the spaces from the text input.
You can check the original tests for code examples:
trim_left
import { trim_left } from "std/text"
pub fun trim_left(text: Text): Text
Trims the spaces at top of the text using sed.
You can check the original tests for code examples:
trim_right
import { trim_right } from "std/text"
pub fun trim_right(text: Text): Text
Trims the spaces at end of the text using sed.
You can check the original tests for code examples:
uppercase
import { uppercase } from "std/text"
pub fun uppercase(text: Text): Text
Makes the text input uppercase using tr.
You can check the original tests for code examples:
zfill
import { zfill } from "std/text"
pub fun zfill(text: Text, length: Num): Text
Pads text with zeros on the left until it reaches the desired length.
You can check the original tests for code examples: