Busca en todas las páginas de la documentación
11 pages in this section.
Why String and &str exist as separate types, the UTF-8 invariant Rust enforces on every str, and why byte-indexing a string is a trap.
Learn Rust string fundamentals with 7 examples. Understand String vs &str, ownership, heap allocation, UTF-8, and conversions.
Learn why Rust's byte-based string indexing can panic and discover safe methods for slicing UTF-8 strings, handling characters, and avoiding common pitfalls.
Learn to build and transform Rust strings using push, push_str, format!, and capacity control. Avoid common pitfalls like reallocations.
Parse strings to types using str::parse and FromStr, and convert types to strings with to_string or format!. Learn error handling and common gotchas.
Format strings in Rust using format!, write!, and std::fmt traits. Control precision, width, alignment, and implement custom Display.
Learn to iterate Rust str as Unicode scalars, raw bytes, or grapheme clusters. Understand chars().count() vs len() bytes and UTF-8 validation.
Learn Rust string best practices for efficient, correct, and allocation-aware text handling. Optimize API types, UTF-8 correctness, and performance.
A single-page roundup of every highlight bullet from the 10 pages in the Strings & Text section, grouped by source page so you can scan all 55 takeaways without opening each article individually.