Module string_ops

Module string_ops 

Source
Expand description

String operations for Seq

These functions are exported with C ABI for LLVM codegen to call.

§Design Decision: split Return Value

split uses Option A (push parts + count):

  • “a b c” “ “ split → “a” “b” “c” 3

This is the simplest approach, requiring no new types. The count allows the caller to know how many parts were pushed.

Re-exports§

pub use patch_seq_char_to_string as char_to_string;
pub use patch_seq_json_escape as json_escape;
pub use patch_seq_string_byte_length as string_byte_length;
pub use patch_seq_string_char_at as string_char_at;
pub use patch_seq_string_concat as string_concat;
pub use patch_seq_string_contains as string_contains;
pub use patch_seq_string_empty as string_empty;
pub use patch_seq_string_equal as string_equal;
pub use patch_seq_string_find as string_find;
pub use patch_seq_string_length as string_length;
pub use patch_seq_string_split as string_split;
pub use patch_seq_string_starts_with as string_starts_with;
pub use patch_seq_string_substring as string_substring;
pub use patch_seq_string_to_int as string_to_int;
pub use patch_seq_string_to_lower as string_to_lower;
pub use patch_seq_string_to_upper as string_to_upper;
pub use patch_seq_string_trim as string_trim;

Functions§

patch_seq_char_to_string
Convert a Unicode code point to a single-character string
patch_seq_json_escape
Escape a string for JSON output
patch_seq_string_byte_length
Get the byte length of a string (UTF-8 encoded)
patch_seq_string_char_at
Get the Unicode code point at a character index
patch_seq_string_concat
Concatenate two strings
patch_seq_string_contains
Check if a string contains a substring
patch_seq_string_empty
Check if a string is empty
patch_seq_string_equal
Check if two strings are equal
patch_seq_string_find
Find the first occurrence of a substring
patch_seq_string_length
Get the length of a string in Unicode characters (code points)
patch_seq_string_split
Split a string on a delimiter
patch_seq_string_starts_with
Check if a string starts with a prefix
patch_seq_string_substring
Extract a substring using character indices
patch_seq_string_to_int
Convert String to Int: ( String – Int Int ) Returns the parsed int and 1 on success, or 0 and 0 on failure. Accepts integers in range [-9223372036854775808, 9223372036854775807] (i64). Trims leading/trailing whitespace before parsing. Leading zeros are accepted (e.g., “007” parses to 7).
patch_seq_string_to_lower
Convert a string to lowercase
patch_seq_string_to_upper
Convert a string to uppercase
patch_seq_string_trim
Trim whitespace from both ends of a string