View Source cure_string_native (cure v0.1.0)
Native Erlang implementations of string operations for Cure.
Provides high-performance string manipulation functions that operate on UTF-8 binaries (String type) and charlists (Charlist type).
Summary
Functions
Get the grapheme at a specific index (0-based). Returns {ok, Grapheme} or {error, out_of_bounds}.
Get the byte size of a string.
Capitalize the first grapheme of a string.
Get a list of Unicode codepoints from a string.
Concatenate two strings efficiently.
Check if a string contains a substring.
Convert string to lowercase (Unicode-aware).
Duplicate a string n times.
Check if a string ends with a given suffix.
Get the first grapheme of a string.
Convert a binary to a string, validating UTF-8. Returns {ok, String} or {error, invalid_utf8}.
Convert a charlist to a UTF-8 string.
Split a string into a list of grapheme clusters.
Check if a string is empty.
Join a list of strings with a separator.
Get the last grapheme of a string.
Get the length of a string in graphemes (Unicode-aware).
Pad a string on the left to a given width.
Pad a string on the right to a given width.
Replace the first occurrence of a pattern.
Replace all occurrences of a pattern.
Reverse a string (Unicode-aware, reverses graphemes).
Extract a substring by grapheme position and length.
Split a string by a pattern.
Split a string at a specific grapheme index.
Check if a string starts with a given prefix.
Convert string to atom.
Convert string to raw binary (identity function for strings).
Convert a UTF-8 string to a charlist.
Trim whitespace from both ends of a string.
Trim whitespace from the left side of a string.
Trim whitespace from the right side of a string.
Convert string to uppercase (Unicode-aware).
Check if a binary is valid UTF-8.
Functions
Get the grapheme at a specific index (0-based). Returns {ok, Grapheme} or {error, out_of_bounds}.
-spec byte_size(binary()) -> non_neg_integer().
Get the byte size of a string.
Capitalize the first grapheme of a string.
Get a list of Unicode codepoints from a string.
Concatenate two strings efficiently.
Check if a string contains a substring.
Convert string to lowercase (Unicode-aware).
-spec duplicate(binary(), non_neg_integer()) -> binary().
Duplicate a string n times.
Check if a string ends with a given suffix.
Get the first grapheme of a string.
Convert a binary to a string, validating UTF-8. Returns {ok, String} or {error, invalid_utf8}.
Convert a charlist to a UTF-8 string.
Split a string into a list of grapheme clusters.
Check if a string is empty.
Join a list of strings with a separator.
Get the last grapheme of a string.
-spec length(binary()) -> non_neg_integer().
Get the length of a string in graphemes (Unicode-aware).
-spec pad_left(binary(), non_neg_integer(), binary()) -> binary().
Pad a string on the left to a given width.
-spec pad_right(binary(), non_neg_integer(), binary()) -> binary().
Pad a string on the right to a given width.
Replace the first occurrence of a pattern.
Replace all occurrences of a pattern.
Reverse a string (Unicode-aware, reverses graphemes).
-spec slice(binary(), integer(), non_neg_integer()) -> binary().
Extract a substring by grapheme position and length.
Split a string by a pattern.
Split a string at a specific grapheme index.
Check if a string starts with a given prefix.
Convert string to atom.
Convert string to raw binary (identity function for strings).
Convert a UTF-8 string to a charlist.
Trim whitespace from both ends of a string.
Trim whitespace from the left side of a string.
Trim whitespace from the right side of a string.
Convert string to uppercase (Unicode-aware).
Check if a binary is valid UTF-8.