Search⌘ K

Core Methods of String Objects

Explore core methods of Rust String objects to understand how to manage string capacity, find substrings, replace content, and trim whitespace. This lesson helps you gain practical skills to manipulate strings effectively using built-in Rust functions.

Some of the core methods are discussed in this lesson. You can find a list of all the String methods in Rust documentation of Strings.

Capacity in Bytes

The capacity gives the number of bytes allocated to the String, unlike len which gives the number of bytes taken by the String object. To get the capacity of a variable in ...