Skip to main content

3 docs tagged with "string"

View all tags

Handling User Input: Parsing Strings

In the previous article, we learned how to get input from the user as a String. However, to build useful applications, we often need to convert that string into a different type, like a number. This process is called parsing. In this article, we'll explore how to parse strings into numbers and handle the potential errors that can occur.

Storing UTF-8 Text with Strings (`String`)

We've already touched on Rust's two main string types, &str and String. In this article, we're going to take a deeper dive into the String type, which is a growable, mutable, owned, UTF-8 encoded string type. It is one of the most common and useful collection types in Rust.

String Types: `&str` and `String`

After exploring compound types like tuples and arrays, we need to address one of the most common and important data types in any language &str (a string slice) and String.