Skip to main content

Module strings

Module strings 

Source
Expand description

String helpers: case conversion, UTF-8-safe truncation, unique-shorthand resolution, and “did you mean?” suggestions.

Structs§

Ambiguity
The candidates a shorthand matched when more than one qualified.

Constants§

DEFAULT_SUGGESTION_DISTANCE
The default maximum edit distance for a suggestion to be offered.

Functions§

nearest
Return the candidate nearest to input within DEFAULT_SUGGESTION_DISTANCE.
nearest_within
Return the candidate nearest to input within max_distance edits.
resolve_unique
Resolve input to the unique candidate whose key equals it.
to_camel_case
Convert a string to camelCase.
to_kebab_case
Convert a string to kebab-case.
to_snake_case
Convert a string to snake_case.
truncate
Safely truncates a string to a UTF-8-safe prefix sized for truncate_owned.
truncate_owned
Safely truncates an owned string to a max byte-length.