From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Demo: Getting started with Rust string manipulation - Rust Tutorial
From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development
Demo: Getting started with Rust string manipulation
- [Instructor] There are many operations that you can do with a string. We're going to explore a couple, and one that we've actually seen before. So let's start at the very top. We're defining a new sentence, and in this case, this sentence is not a string, it's a string slice. So let's quickly make it a string, and make sure that we can actually start working with that, and what are we going to try to do here is we're going to print, try to get the first three characters. So this is a using a slice. This is a slice in a string. We're getting the three first characters. So let's just run these, and actually let me comment this one out, so we only get information of what we're trying to execute here. So I'm going to run that, and so we're getting the right there. Now remember that ranges are, you can actually go ahead and do inclusive, which would be the equal sign here. Let's see if we're getting that. So before we're getting T-H-E and the space, and now we're getting the Q as well…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to strings and vectors1m 16s
-
(Locked)
Demo: Understanding string and str5m 16s
-
(Locked)
Demo: Getting started with Rust string manipulation6m 25s
-
(Locked)
Demo: Basics of vectors6m 42s
-
(Locked)
Demo: Retrieving values from vectors7m 52s
-
(Locked)
Demo: Adding elements to vectors3m 43s
-
(Locked)
Summary of strings and vectors1m 20s
-
(Locked)
-
-
-
-
-