Module
Module documentation.
modulestrings
@briefString utilities
@detailsProvides common string helpers such as search, case conversion, splitting, and joining.
@see
- index.html
Classes
Classes and inheritance.
Functions
Free functions and class methods.
functionstrings::__find_substr_from_fast
Signature
extern func __find_substr_from_fast(s: String, pat: String, start: Int) -> Int;extern func __find_substr_from_fast(s: String, pat: String, start: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__find_substr_ascii_case_from_fast`.@briefBinds the low-level runtime symbol `__find_substr_from_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionstrings::__find_substr_ascii_case_from_fast
Signature
extern func __find_substr_ascii_case_from_fast(s: String, pat: String, start: Int) -> Int;extern func __find_substr_ascii_case_from_fast(s: String, pat: String, start: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__strings_last_index_fast`.@briefBinds the low-level runtime symbol `__find_substr_ascii_case_from_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionstrings::__strings_last_index_fast
Signature
extern func __strings_last_index_fast(s: String, pat: String) -> Int;extern func __strings_last_index_fast(s: String, pat: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__strings_count_fast`.@briefBinds the low-level runtime symbol `__strings_last_index_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
@returnReturns the operation result as `Int`.
functionstrings::__strings_count_fast
Signature
extern func __strings_count_fast(s: String, pat: String) -> Int;extern func __strings_count_fast(s: String, pat: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__strings_to_lower_ascii_fast`.@briefBinds the low-level runtime symbol `__strings_count_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
@returnReturns the operation result as `Int`.
functionstrings::__strings_to_lower_ascii_fast
Signature
extern func __strings_to_lower_ascii_fast(s: String) -> String;extern func __strings_to_lower_ascii_fast(s: String) -> String;
/*
@brief Binds the low-level runtime symbol `__strings_to_upper_ascii_fast`.@briefBinds the low-level runtime symbol `__strings_to_lower_ascii_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::__strings_to_upper_ascii_fast
Signature
extern func __strings_to_upper_ascii_fast(s: String) -> String;extern func __strings_to_upper_ascii_fast(s: String) -> String;
/*
@brief Binds the low-level runtime symbol `__strings_replace_fast`.@briefBinds the low-level runtime symbol `__strings_to_upper_ascii_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::__strings_replace_fast
Signature
extern func __strings_replace_fast(s: String, pat: String, repl: String, max_count: Int) -> String;extern func __strings_replace_fast(s: String, pat: String, repl: String, max_count: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__strings_trim_ascii_fast`.@briefBinds the low-level runtime symbol `__strings_replace_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- replReplacement text inserted when a match or placeholder is found.
- max_countMaximum allowed count or byte size.
@returnReturns the operation result as `String`.
functionstrings::__strings_trim_ascii_fast
Signature
extern func __strings_trim_ascii_fast(s: String, mode: Int) -> String;extern func __strings_trim_ascii_fast(s: String, mode: Int) -> String;
/*@briefBinds the low-level runtime symbol `__strings_trim_ascii_fast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- sInput string.
- modeMode value that selects permissions, behavior, or formatting rules for the operation.
@returnReturns the operation result as `String`.
functionstrings::contains
Signature
func contains(s: String, sub: String) -> Boolfunc contains(s: String, sub: String) -> Bool {
return find_substr(s, sub) >= 0;
}@briefCheck whether a substring exists
@detailsReturns true if sub appears anywhere in s.
@param
- sSource string
- subSubstring to search for
@returnWhether s contains sub
functionstrings::index
Signature
func index(s: String, sub: String) -> Intfunc index(s: String, sub: String) -> Int {
return find_substr(s, sub);
}@briefFind the first occurrence of a substring
@detailsReturns the start index of the first occurrence of sub in s.
@param
- sSource string
- subSubstring to search for
@returnStart index.
functionstrings::index_from
Signature
func index_from(s: String, sub: String, start: Int) -> Intfunc index_from(s: String, sub: String, start: Int) -> Int {
return find_substr_from(s, sub, start);
}@briefProvides the system library operation `index_from`.
@detailsExecutes the `index_from` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- subSubstring, submatch, or subcommand value selected by the operation.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionstrings::find_substr_from
Signature
func find_substr_from(s: String, pat: String, start: Int) -> Intfunc find_substr_from(s: String, pat: String, start: Int) -> Int {
return __find_substr_from_fast(s, pat, start);
}@briefFinds a matching position or element with `find_substr_from`.
@detailsExecutes the `find_substr_from` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionstrings::find_substr
Signature
func find_substr(s: String, pat: String) -> Intfunc find_substr(s: String, pat: String) -> Int {
return find_substr_from(s, pat, 0);
}@briefFinds a matching position or element with `find_substr`.
@detailsExecutes the `find_substr` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
@returnReturns the operation result as `Int`.
functionstrings::find_substr_ascii_case_from
Signature
func find_substr_ascii_case_from(s: String, pat: String, start: Int) -> Intfunc find_substr_ascii_case_from(s: String, pat: String, start: Int) -> Int {
return __find_substr_ascii_case_from_fast(s, pat, start);
}@briefFinds a matching position or element with `find_substr_ascii_case_from`.
@detailsExecutes the `find_substr_ascii_case_from` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionstrings::find_substr_ascii_case
Signature
func find_substr_ascii_case(s: String, pat: String) -> Intfunc find_substr_ascii_case(s: String, pat: String) -> Int {
return find_substr_ascii_case_from(s, pat, 0);
}@briefFinds a matching position or element with `find_substr_ascii_case`.
@detailsExecutes the `find_substr_ascii_case` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
@returnReturns the operation result as `Int`.
functionstrings::contains_ascii_case
Signature
func contains_ascii_case(s: String, sub: String) -> Boolfunc contains_ascii_case(s: String, sub: String) -> Bool {
return find_substr_ascii_case(s, sub) >= 0;
}@briefProvides the system library operation `contains_ascii_case`.
@detailsExecutes the `contains_ascii_case` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- subSubstring, submatch, or subcommand value selected by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::equal_fold_ascii
Signature
func equal_fold_ascii(a: String, b: String) -> Boolfunc equal_fold_ascii(a: String, b: String) -> Bool {
if std.len(a) != std.len(b) {
return false;@briefProvides the system library operation `equal_fold_ascii`.
@detailsExecutes the `equal_fold_ascii` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- aInput value used for comparison, computation, or conversion.
- bInput value used for comparison, computation, or conversion.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::count
Signature
func count(s: String, sub: String) -> Intfunc count(s: String, sub: String) -> Int {
return __strings_count_fast(s, sub);
}@briefProvides the system library operation `count`.
@detailsExecutes the `count` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- subSubstring, submatch, or subcommand value selected by the operation.
@returnReturns the operation result as `Int`.
functionstrings::last_index
Signature
func last_index(s: String, sub: String) -> Intfunc last_index(s: String, sub: String) -> Int {
return __strings_last_index_fast(s, sub);
}@briefFind the last occurrence of a substring
@param
- sSource string
- subSubstring to search for
@returnStart index.
functionstrings::trim_space
Signature
func trim_space(s: String) -> Stringfunc trim_space(s: String) -> String {
return trim(s);
}@briefTrim leading and trailing whitespace
@detailsCalls strings.trim(s) to remove leading/trailing whitespace (as defined by strings.is_space).
@param
- sInput string
@returnTrimmed string
functionstrings::is_ascii_space_byte
Signature
func is_ascii_space_byte(ch: Int) -> Boolfunc is_ascii_space_byte(ch: Int) -> Bool {
return ch == 32 || ch == 9 || ch == 10 || ch == 13;
}@briefTests whether the state satisfies the condition represented by `is_ascii_space_byte`.
@detailsExecutes the `is_ascii_space_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_ascii_lower_byte
Signature
func is_ascii_lower_byte(ch: Int) -> Boolfunc is_ascii_lower_byte(ch: Int) -> Bool {
return ch >= 97 && ch <= 122;
}@briefTests whether the state satisfies the condition represented by `is_ascii_lower_byte`.
@detailsExecutes the `is_ascii_lower_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_ascii_upper_byte
Signature
func is_ascii_upper_byte(ch: Int) -> Boolfunc is_ascii_upper_byte(ch: Int) -> Bool {
return ch >= 65 && ch <= 90;
}@briefTests whether the state satisfies the condition represented by `is_ascii_upper_byte`.
@detailsExecutes the `is_ascii_upper_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_ascii_alpha_byte
Signature
func is_ascii_alpha_byte(ch: Int) -> Boolfunc is_ascii_alpha_byte(ch: Int) -> Bool {
return is_ascii_lower_byte(ch) || is_ascii_upper_byte(ch);
}@briefTests whether the state satisfies the condition represented by `is_ascii_alpha_byte`.
@detailsExecutes the `is_ascii_alpha_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_ascii_digit_byte
Signature
func is_ascii_digit_byte(ch: Int) -> Boolfunc is_ascii_digit_byte(ch: Int) -> Bool {
return ch >= 48 && ch <= 57;
}@briefTests whether the state satisfies the condition represented by `is_ascii_digit_byte`.
@detailsExecutes the `is_ascii_digit_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_ascii_alnum_byte
Signature
func is_ascii_alnum_byte(ch: Int) -> Boolfunc is_ascii_alnum_byte(ch: Int) -> Bool {
return is_ascii_alpha_byte(ch) || is_ascii_digit_byte(ch);
}@briefTests whether the state satisfies the condition represented by `is_ascii_alnum_byte`.
@detailsExecutes the `is_ascii_alnum_byte` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::is_space
Signature
func is_space(ch: String) -> Boolfunc is_space(ch: String) -> Bool {
return std.len(ch) == 1 && is_ascii_space_byte(std.byte_at(ch, 0));
}@briefTests whether the state satisfies the condition represented by `is_space`.
@detailsExecutes the `is_space` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::trim_left
Signature
func trim_left(s: String) -> Stringfunc trim_left(s: String) -> String {
return __strings_trim_ascii_fast(s, 1);
}@briefProvides the system library operation `trim_left`.
@detailsExecutes the `trim_left` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::trim_right
Signature
func trim_right(s: String) -> Stringfunc trim_right(s: String) -> String {
return __strings_trim_ascii_fast(s, 2);
}@briefProvides the system library operation `trim_right`.
@detailsExecutes the `trim_right` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::trim
Signature
func trim(s: String) -> Stringfunc trim(s: String) -> String {
return __strings_trim_ascii_fast(s, 0);
}@briefProvides the system library operation `trim`.
@detailsExecutes the `trim` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::trim_prefix
Signature
func trim_prefix(s: String, prefix: String) -> Stringfunc trim_prefix(s: String, prefix: String) -> String {
if starts_with(s, prefix) {
return std.substr(s, std.len(prefix), std.len(s) - std.len(prefix));@briefProvides the system library operation `trim_prefix`.
@detailsExecutes the `trim_prefix` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- prefixPrefix string matched, added, stripped, or used to build keys and paths.
@returnReturns the operation result as `String`.
functionstrings::trim_suffix
Signature
func trim_suffix(s: String, suffix: String) -> Stringfunc trim_suffix(s: String, suffix: String) -> String {
if ends_with(s, suffix) {
return std.substr(s, 0, std.len(s) - std.len(suffix));@briefProvides the system library operation `trim_suffix`.
@detailsExecutes the `trim_suffix` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- suffixSuffix string matched, appended, or removed by the operation.
@returnReturns the operation result as `String`.
functionstrings::strip_prefix
Signature
func strip_prefix(s: String, prefix: String) -> Stringfunc strip_prefix(s: String, prefix: String) -> String {
return trim_prefix(s, prefix);
}@briefProvides the system library operation `strip_prefix`.
@detailsExecutes the `strip_prefix` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- prefixPrefix string matched, added, stripped, or used to build keys and paths.
@returnReturns the operation result as `String`.
functionstrings::strip_suffix
Signature
func strip_suffix(s: String, suffix: String) -> Stringfunc strip_suffix(s: String, suffix: String) -> String {
return trim_suffix(s, suffix);
}@briefProvides the system library operation `strip_suffix`.
@detailsExecutes the `strip_suffix` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- suffixSuffix string matched, appended, or removed by the operation.
@returnReturns the operation result as `String`.
functionstrings::to_lower
Signature
func to_lower(s: String) -> Stringfunc to_lower(s: String) -> String {
return to_lower_ascii(s);
}@briefASCII lowercasing
@detailsConverts A-Z to a-z in s (does not handle Unicode).
@param
- sInput string
@returnLowercased string
functionstrings::to_upper
Signature
func to_upper(s: String) -> Stringfunc to_upper(s: String) -> String {
return to_upper_ascii(s);
}@briefASCII uppercasing
@detailsConverts a-z to A-Z in s (does not handle Unicode).
@param
- sInput string
@returnUppercased string
functionstrings::lower_ascii_char
Signature
func lower_ascii_char(ch: String) -> Stringfunc lower_ascii_char(ch: String) -> String {
if std.len(ch) != 1 {
return ch;@briefProvides the system library operation `lower_ascii_char`.
@detailsExecutes the `lower_ascii_char` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns the operation result as `String`.
functionstrings::upper_ascii_char
Signature
func upper_ascii_char(ch: String) -> Stringfunc upper_ascii_char(ch: String) -> String {
if std.len(ch) != 1 {
return ch;@briefProvides the system library operation `upper_ascii_char`.
@detailsExecutes the `upper_ascii_char` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- chCharacter code or channel handle processed by the operation.
@returnReturns the operation result as `String`.
functionstrings::to_lower_ascii
Signature
func to_lower_ascii(s: String) -> Stringfunc to_lower_ascii(s: String) -> String {
return __strings_to_lower_ascii_fast(s);
}@briefConverts to the target representation with `to_lower_ascii`.
@detailsExecutes the `to_lower_ascii` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::to_upper_ascii
Signature
func to_upper_ascii(s: String) -> Stringfunc to_upper_ascii(s: String) -> String {
return __strings_to_upper_ascii_fast(s);
}@briefConverts to the target representation with `to_upper_ascii`.
@detailsExecutes the `to_upper_ascii` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `String`.
functionstrings::starts_with
Signature
func starts_with(s: String, prefix: String) -> Boolfunc starts_with(s: String, prefix: String) -> Bool {
return std.view(s).starts_with(std.view(prefix));
}@briefProvides the system library operation `starts_with`.
@detailsExecutes the `starts_with` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- prefixPrefix string matched, added, stripped, or used to build keys and paths.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::repeat
Signature
func repeat(s: String, n: Int) -> Stringfunc repeat(s: String, n: Int) -> String {
if n <= 0 {
return "";@briefProvides the system library operation `repeat`.
@detailsExecutes the `repeat` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- nCount, size, or limit value.
@returnReturns the operation result as `String`.
functionstrings::ends_with
Signature
func ends_with(s: String, suffix: String) -> Boolfunc ends_with(s: String, suffix: String) -> Bool {
return std.view(s).ends_with(std.view(suffix));
}@briefProvides the system library operation `ends_with`.
@detailsExecutes the `ends_with` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- suffixSuffix string matched, appended, or removed by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionstrings::replace_n
Signature
func replace_n(s: String, pat: String, repl: String, max_count: Int) -> Stringfunc replace_n(s: String, pat: String, repl: String, max_count: Int) -> String {
return __strings_replace_fast(s, pat, repl, max_count);
}@briefProvides the system library operation `replace_n`.
@detailsExecutes the `replace_n` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- replReplacement text inserted when a match or placeholder is found.
- max_countMaximum allowed count or byte size.
@returnReturns the operation result as `String`.
functionstrings::replace_all
Signature
func replace_all(s: String, pat: String, repl: String) -> Stringfunc replace_all(s: String, pat: String, repl: String) -> String {
return replace_n(s, pat, repl, -1);
}@briefProvides the system library operation `replace_all`.
@detailsExecutes the `replace_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- replReplacement text inserted when a match or placeholder is found.
@returnReturns the operation result as `String`.
functionstrings::replace_first
Signature
func replace_first(s: String, pat: String, repl: String) -> Stringfunc replace_first(s: String, pat: String, repl: String) -> String {
return replace_n(s, pat, repl, 1);
}@briefProvides the system library operation `replace_first`.
@detailsExecutes the `replace_first` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- replReplacement text inserted when a match or placeholder is found.
@returnReturns the operation result as `String`.
functionstrings::parse_hex_int
Signature
func parse_hex_int(s: String) -> Intfunc parse_hex_int(s: String) -> Int {
let t: String = trim_space(s);
let n: Int = std.len(t);@briefParse a hexadecimal integer prefix
@param
- sInput string
@returnParsed integer value, or 0 if no hexadecimal digit is present
functionstrings::split_ranges
Signature
func split_ranges(s: String, sep: String, out: collections.Vector<Int>) -> Intfunc split_ranges(s: String, sep: String, out: collections.Vector<Int>) -> Int {
let n: Int = std.len(s);
let m: Int = std.len(sep);@briefSplit by delimiter and output ranges
@param
- sInput string
- sepDelimiter string
- outOutput ranges (appended.
@returnNumber of segments (returned by strings.split_ranges)
@see
- strings.split_ranges
functionstrings::join_ranges
Signature
func join_ranges(src: String, ranges: collections.Vector<Int>, sep: String) -> Stringfunc join_ranges(src: String, ranges: collections.Vector<Int>, sep: String) -> String {
let bld: std.StringBuilder = new std.StringBuilder(std.len(src) + ranges.len() * std.len(sep));
let first: Bool = true;@briefJoin string slices by ranges
@param
- srcSource string
- rangesRange array (start/end pairs)
- sepSeparator string
@returnJoined string
functionstrings::split
Signature
func split(s: String, sep: String) -> collections.Vector<String>func split(s: String, sep: String) -> collections.Vector<String> {
let out: collections.Vector<String> = new collections.Vector<String>();
let n: Int = std.len(s);@briefProvides the system library operation `split`.
@detailsExecutes the `split` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- sepSeparator string used when splitting or joining text.
@returnReturns the operation result as `collections.Vector<String>`.
functionstrings::fields
Signature
func fields(s: String) -> collections.Vector<String>func fields(s: String) -> collections.Vector<String> {
let out: collections.Vector<String> = new collections.Vector<String>();
let sv: std.StringView = std.view(s);@briefProvides the system library operation `fields`.
@detailsExecutes the `fields` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns the operation result as `collections.Vector<String>`.
functionstrings::join_parts
Signature
func join_parts(parts: collections.Vector<String>, sep: String) -> Stringfunc join_parts(parts: collections.Vector<String>, sep: String) -> String {
if parts.len() == 0 {
return "";@briefProvides the system library operation `join_parts`.
@detailsExecutes the `join_parts` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- partsOrdered collection of string or protocol fragments joined, encoded, or inspected by the operation.
- sepSeparator string used when splitting or joining text.
@returnReturns the operation result as `String`.
Variables
Class fields (var).