Skip to main content

Module strings

Module strings 

Source

Structsยง

FmtSpec ๐Ÿ”’
Parsed format specifier from a sprintf format string.

Enumsยง

StringError
Structured error type for string operations.

Staticsยง

__BUILTIN_REG_BUILTIN_AGREP ๐Ÿ”’
__BUILTIN_REG_BUILTIN_AGREPL ๐Ÿ”’
__BUILTIN_REG_BUILTIN_AS_RAW ๐Ÿ”’
__BUILTIN_REG_BUILTIN_BASENAME ๐Ÿ”’
__BUILTIN_REG_BUILTIN_CASEFOLD ๐Ÿ”’
__BUILTIN_REG_BUILTIN_CHARTR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_CHAR_TO_RAW ๐Ÿ”’
__BUILTIN_REG_BUILTIN_DEPARSE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_DEPARSE1 ๐Ÿ”’
__BUILTIN_REG_BUILTIN_DIRNAME ๐Ÿ”’
__BUILTIN_REG_BUILTIN_DQUOTE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ENC2NATIVE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ENC2UTF8 ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ENCODE_STRING ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ENCODING ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ENDS_WITH ๐Ÿ”’
__BUILTIN_REG_BUILTIN_FORMAT_C ๐Ÿ”’
__BUILTIN_REG_BUILTIN_FORMAT_PVAL ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GETTEXT ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GETTEXTF ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GLOB2RX ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GREGEXPR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GREP ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GREPL ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GSUB ๐Ÿ”’
__BUILTIN_REG_BUILTIN_ICONV ๐Ÿ”’
__BUILTIN_REG_BUILTIN_INT_TO_UTF8 ๐Ÿ”’
__BUILTIN_REG_BUILTIN_IS_RAW ๐Ÿ”’
__BUILTIN_REG_BUILTIN_MAKE_NAMES ๐Ÿ”’
__BUILTIN_REG_BUILTIN_MAKE_UNIQUE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_NGETTEXT ๐Ÿ”’
__BUILTIN_REG_BUILTIN_NZCHAR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_PRETTY_NUM ๐Ÿ”’
__BUILTIN_REG_BUILTIN_RAW ๐Ÿ”’
__BUILTIN_REG_BUILTIN_RAW_SHIFT ๐Ÿ”’
__BUILTIN_REG_BUILTIN_RAW_TO_CHAR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_REGEXEC ๐Ÿ”’
__BUILTIN_REG_BUILTIN_REGEXPR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_REGMATCHES ๐Ÿ”’
__BUILTIN_REG_BUILTIN_REGMATCHES_ASSIGN ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SPRINTF ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SQUOTE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STARTS_WITH ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STRREP ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STRSPLIT ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STRTOI ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STRTRIM ๐Ÿ”’
__BUILTIN_REG_BUILTIN_STRWRAP ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SUB ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SUBSTR ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SUBSTR_ASSIGN ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SYS_GETLOCALE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_SYS_SETLOCALE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TOLOWER ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TOUPPER ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TO_STRING ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TRIMWS ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TYPE_CONVERT ๐Ÿ”’
__BUILTIN_REG_BUILTIN_URLDECODE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_URLENCODE ๐Ÿ”’
__BUILTIN_REG_BUILTIN_UTF8_TO_INT ๐Ÿ”’
__INTERP_REG_INTERP_DPUT ๐Ÿ”’

Functionsยง

approximate_contains ๐Ÿ”’
Check whether haystack contains a substring approximately matching needle within the given maximum edit distance. Uses a sliding-window approach: for each window of length needle.len() +/- max_dist, compute Levenshtein distance.
build_fixed_searcher ๐Ÿ”’
Build an AhoCorasick automaton for a single fixed pattern, optionally case-insensitive. This builds the automaton once and amortizes the cost across many haystack searches.
build_regex ๐Ÿ”’
builtin_agrep ๐Ÿ”’
Approximate grep: search for approximate pattern matches in a character vector.
builtin_agrepl ๐Ÿ”’
Approximate grepl: test whether a pattern approximately matches each element.
builtin_as_raw ๐Ÿ”’
as.raw(x) โ€” coerce to raw (byte) values (0-255), truncating to lowest byte.
builtin_basename ๐Ÿ”’
Extract the file name from paths.
builtin_casefold ๐Ÿ”’
Convert case of a character vector.
builtin_char_to_raw ๐Ÿ”’
Convert a character string to a raw (byte) vector.
builtin_chartr ๐Ÿ”’
Translate characters in strings (character-by-character substitution).
builtin_deparse ๐Ÿ”’
Convert an R expression or value to its string representation.
builtin_deparse1 ๐Ÿ”’
Single-string deparse (R 4.0+). Collapses multi-line deparse output.
builtin_dirname ๐Ÿ”’
Extract the directory part from paths.
builtin_dquote ๐Ÿ”’
Wrap strings in double (typographic) quotes.
builtin_enc2native ๐Ÿ”’
Convert character vector to native encoding (passthrough in miniR).
builtin_enc2utf8 ๐Ÿ”’
Convert character vector to UTF-8 encoding (passthrough in miniR).
builtin_encode_string ๐Ÿ”’
Encode a character string with optional quoting, width, and justification.
builtin_encoding ๐Ÿ”’
Report the encoding of character strings.
builtin_ends_with ๐Ÿ”’
Test whether strings end with a given suffix.
builtin_format_c ๐Ÿ”’
Formatted printing of numbers and strings, similar to Cโ€™s printf family.
builtin_format_pval ๐Ÿ”’
Format p-values for display, showing e.g. โ€œ< 2.2e-16โ€ for very small values.
builtin_gettext ๐Ÿ”’
Translate a message (i18n stub โ€” returns the message unchanged).
builtin_gettextf ๐Ÿ”’
Format and translate a message (i18n stub โ€” delegates to sprintf).
builtin_glob2rx ๐Ÿ”’
Convert a glob (wildcard) pattern to a regular expression.
builtin_gregexpr ๐Ÿ”’
Find all matches of a pattern in each element of a character vector.
builtin_grep ๐Ÿ”’
Search for pattern matches in a character vector.
builtin_grepl ๐Ÿ”’
Test whether a pattern matches each element of a character vector.
builtin_gsub ๐Ÿ”’
Replace all occurrences of a pattern in character strings.
builtin_iconv ๐Ÿ”’
Convert character strings between encodings.
builtin_int_to_utf8 ๐Ÿ”’
Convert integer Unicode code points to a UTF-8 string.
builtin_is_raw ๐Ÿ”’
is.raw(x) โ€” test if argument is a raw vector.
builtin_make_names ๐Ÿ”’
Make syntactically valid R names from character strings.
builtin_make_unique ๐Ÿ”’
Make character strings unique by appending sequence numbers to duplicates.
builtin_ngettext ๐Ÿ”’
Translate a message with singular/plural forms (i18n stub).
builtin_nzchar ๐Ÿ”’
Test whether character strings are non-empty.
builtin_pretty_num ๐Ÿ”’
Format numbers with separators for readability (e.g., thousand separators).
builtin_raw ๐Ÿ”’
raw(length) โ€” create a raw (byte) vector of zeros.
builtin_raw_shift ๐Ÿ”’
rawShift(x, n) โ€” bitwise shift of raw (byte) values. Positive n shifts left, negative n shifts right.
builtin_raw_to_char ๐Ÿ”’
Convert a raw (byte) vector to a character string.
builtin_regexec ๐Ÿ”’
Match a pattern with capture groups against a character vector.
builtin_regexpr ๐Ÿ”’
Find the first match of a pattern in each element of a character vector.
builtin_regmatches ๐Ÿ”’
Extract matched substrings from regexpr/gregexpr results.
builtin_regmatches_assign ๐Ÿ”’
Replace matched substrings using regexpr/gregexpr match data.
builtin_sprintf ๐Ÿ”’
Format strings using C-style format specifiers, vectorized over arguments.
builtin_squote ๐Ÿ”’
Wrap strings in single (typographic) quotes.
builtin_starts_with ๐Ÿ”’
Test whether strings start with a given prefix.
builtin_strrep ๐Ÿ”’
Repeat each element of a character vector a specified number of times.
builtin_strsplit ๐Ÿ”’
Split strings by a pattern or fixed delimiter.
builtin_strtoi ๐Ÿ”’
Convert strings to integers using a specified base (radix).
builtin_strtrim ๐Ÿ”’
Trim character strings to a specified display width.
builtin_strwrap ๐Ÿ”’
Wrap character strings to a specified width.
builtin_sub ๐Ÿ”’
Replace the first occurrence of a pattern in character strings.
builtin_substr ๐Ÿ”’
Extract substrings from character strings.
builtin_substr_assign ๐Ÿ”’
Replace substrings in character strings.
builtin_sys_getlocale ๐Ÿ”’
Get the current locale setting (stub โ€” returns โ€œCโ€ locale).
builtin_sys_setlocale ๐Ÿ”’
Set the locale (stub โ€” accepts but ignores the setting).
builtin_to_string ๐Ÿ”’
Collapse a vector into a single comma-separated string.
builtin_tolower ๐Ÿ”’
Convert strings to lower case.
builtin_toupper ๐Ÿ”’
Convert strings to upper case.
builtin_trimws ๐Ÿ”’
Remove leading and/or trailing whitespace from strings.
builtin_type_convert ๐Ÿ”’
Auto-convert character vector to appropriate type.
builtin_urldecode ๐Ÿ”’
Decode percent-encoded URL strings.
builtin_urlencode ๐Ÿ”’
Percent-encode URL strings per RFC 3986.
builtin_utf8_to_int ๐Ÿ”’
Convert a UTF-8 string to integer Unicode code points.
collect_fmt_specs ๐Ÿ”’
Collect the format specifiers from a format string, returning a list of (FmtSpec, arg_index) pairs (0-based among the data args, i.e. excluding fmt).
convert_replacement ๐Ÿ”’
Convert R-style replacement backreferences (\1, \2) to regex crate style ($1, $2)
fixed_gsub ๐Ÿ”’
Replace all occurrences of needle in haystack with replacement.
fixed_split ๐Ÿ”’
Split haystack on all occurrences of needle.
format_g ๐Ÿ”’
Format using %g/%G: use shorter of %f and %e, removing trailing zeros.
format_scientific ๐Ÿ”’
Format a float in scientific notation matching Rโ€™s output (two-digit exponent minimum).
get_regex_opts ๐Ÿ”’
Extract common regex options from named args: fixed, ignore.case, perl
iconv_one ๐Ÿ”’
Convert a single string between encodings using bstr for byte-level access.
insert_marks ๐Ÿ”’
Insert big_mark every 3 digits before the decimal point and small_mark every 3 digits after the decimal point.
interp_dput ๐Ÿ”’
Write a deparsed representation of an R object to stdout.
levenshtein_distance ๐Ÿ”’
Compute the Levenshtein edit distance between two strings. Uses a single-row DP approach (O(min(m,n)) space).
normalize_encoding_name ๐Ÿ”’
Normalize an encoding name to a canonical form.
parse_fmt_spec ๐Ÿ”’
Parse a format specifier starting after โ€˜%โ€™. Returns (FmtSpec, chars consumed).
parse_max_distance ๐Ÿ”’
Parse Rโ€™s max.distance argument for agrep/agrepl. R accepts either a single numeric (fraction of pattern length if < 1, absolute if >= 1) or a named list. We support the simple numeric case.
sprintf_one ๐Ÿ”’
Format one string from the format template, using element elem_idx from each data-arg vector (with recycling).
translate_pcre_to_rust ๐Ÿ”’
Build a compiled regex from a pattern string, respecting fixed and ignore.case options. Returns Err(RError) if the pattern is invalid regex. Translate R/PCRE regex patterns to Rust regex syntax.
trim_to_width ๐Ÿ”’
Trim a string to at most max_width display columns.