Sling Academy
Home/Rust/Working with strings in Rust

Working with strings in Rust

This series of tutorials shows you how to process and manipulate strings in Rust.

1 Understanding Ownership and Borrowing in Rust String Operations

2 Rust String Fundamentals: Memory Layout and UTF-8 Encoding

3 Comparing `String` and `&str` in Rust for Optimal Usage

4 Creating and Initializing Rust Strings: `String::new()` vs `to_string()`

5 Concatenating Rust Strings with `push_str`, `push`, and the `+` Operator

6 Splitting Rust Strings Using `split()`, `split_whitespace()`, and `split_terminator()`

7 Trimming and Stripping Rust Strings for Clean Data Processing

8 Finding Substrings in Rust: Using `find()`, `contains()`, and Pattern Matching

9 Replacing and Transforming Rust Strings with `replace()`, `to_uppercase()`, and More

10 Converting Between Rust Strings and Other Data Types (Integers, Floats)

11 Parsing Rust Strings into Complex Data Structures Safely

12 Using Raw Strings in Rust for Escaping and Special Characters

13 Inspecting Rust Strings with Iterators: `chars()`, `bytes()`, and Beyond

14 Building Dynamic Text with Rust’s `format!` Macro

15 Handling Non-ASCII and Unicode Characters in Rust Strings

16 Slicing Rust Strings Correctly to Avoid Panic

17 Rust String Immutability vs Mutable String Buffers

18 Performance Considerations: When to Use `Cow<str>` in Rust

19 Debugging Common Rust String Errors: Indexing and UTF-8 Pitfalls

20 Combining Rust Strings with the `Iterator` Trait for Functional Operations

21 Advanced Rust String Operations: Substring Extraction and Ranges

22 Working with ASCII-Only Data in Rust: Pros, Cons, and Methods

23 Case Transformations in Rust Strings: Uppercase, Lowercase, Titlecase

24 Converting Rust Byte Arrays to Strings with `from_utf8` Safely

25 Reading and Writing Strings in Rust from Files and Standard I/O

26 Escaping and Unescaping Special Characters in Rust Strings

27 Leveraging Regular Expressions in Rust for Complex String Searches

28 Handling String Encoding and Decoding for FFI in Rust

29 Logging and Error Messages: Leveraging Rust Strings for Diagnostics

30 Rust String Comparisons: Equality, PartialEq, and Lexical Ordering

31 Building JSON-Ready Strings in Rust for Web Applications

32 Working with `CString` and `CStr` to Integrate Rust Strings with C Code

33 Generating Random Rust Strings for Testing and Prototyping

34 Zeroizing Sensitive Data in Rust Strings for Security

35 Benchmarking Rust String Operations with Criterion

36 Rust Slice Patterns: More Advanced Techniques for String Parsing

37 Creating Custom String Utilities and Libraries in Rust

38 Implementing Custom Formatters for Rust Strings

39 Best Practices for Memory Safety and Efficiency When Working with Rust Strings