#string Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Rust String vs &str — The Cheat Sheet
`String` is an owned, growable heap allocation; `&str` is a borrowed view into a UTF-8 buffer. Function params should usually take `&str`; return types use `String` when ownership is needed.
JavaScript Slugify String
Converts any string into a URL-safe slug: lowercases it, replaces accented characters with ASCII equivalents, strips all non-alphanumeric characters (except hyphens), and collapses multiple hyphens into one. Ideal for generating URL slugs from blog titles, product names, or user input.
JavaScript Capitalize Words (Title Case)
Converts a string to title case by capitalising the first letter of each word. Handles multiple spaces and mixed-case input. Optionally skips common English stopwords (a, an, the, of, in, …) so article/preposition words are not capitalised in the middle of a title — matching standard editorial style guides.
JavaScript Truncate String
Truncates a string to a maximum character length and appends an ellipsis (or custom suffix). The smart version breaks at the last word boundary to avoid cutting in the middle of a word, making truncated text look natural in card previews, notifications, and list views.