1 00:00:05,820 --> 00:00:08,300 In this video, we'll learn about c++ strings. 2 00:00:09,170 --> 00:00:14,129 Standard string is a class in the c++ standard template library or stl. 3 00:00:14,679 --> 00:00:17,900 We could do an entire course on just the scl, and that course 4 00:00:17,900 --> 00:00:19,520 would be very long and complex. 5 00:00:19,870 --> 00:00:22,229 So in this video, I'll only talk about the major elements 6 00:00:22,230 --> 00:00:23,880 of the c++ string class. 7 00:00:24,440 --> 00:00:28,849 In order to use c++ plus strings, you must include the string header file. 8 00:00:29,759 --> 00:00:31,659 Strings are in the standard namespace. 9 00:00:31,659 --> 00:00:34,910 So in order to use them without using namespace standard, you 10 00:00:34,920 --> 00:00:38,510 must prefix them with standard and the scope resolution operator. 11 00:00:39,060 --> 00:00:41,600 This is also true for the standard string methods 12 00:00:41,600 --> 00:00:43,290 that work with c++ strings. 13 00:00:43,940 --> 00:00:48,329 Like c-style strings, c++ strings are stored contiguously in memory. 14 00:00:48,900 --> 00:00:53,350 However, unlike c-style strings which are fixed in size, c++ 15 00:00:53,350 --> 00:00:56,870 strings are dynamic and can grow and shrink as needed at runtime. 16 00:00:57,710 --> 00:01:01,519 C++ strings work with the stream insertion and extraction operators 17 00:01:01,810 --> 00:01:04,129 just like most other types in c++. 18 00:01:04,610 --> 00:01:08,490 The c++ string class provides a rich set of methods or functions that 19 00:01:08,490 --> 00:01:10,520 allow us to manipulate strings easily. 20 00:01:11,080 --> 00:01:13,580 Chances are that if you need to do something with the string 21 00:01:13,730 --> 00:01:16,310 that functionality is already there for you without having 22 00:01:16,310 --> 00:01:17,660 to rewrite it from scratch. 23 00:01:18,560 --> 00:01:22,119 C++ strings also work with most of the operators that we're used to for 24 00:01:22,120 --> 00:01:24,179 assigning, comparing and so forth. 25 00:01:24,550 --> 00:01:28,449 This is a huge advantage over c-style strings since c-style strings don't 26 00:01:28,449 --> 00:01:29,979 work well with those operators. 27 00:01:30,520 --> 00:01:34,190 Even though c++ strings are preferred in most cases sometimes 28 00:01:34,190 --> 00:01:35,730 you need to use c-style strings. 29 00:01:36,010 --> 00:01:38,039 Maybe you're interfacing with a library that's been 30 00:01:38,039 --> 00:01:39,660 optimized for c-style strings. 31 00:01:40,039 --> 00:01:42,830 Well, in this use case, you can still use c++ strings 32 00:01:42,840 --> 00:01:44,160 and take advantage of them. 33 00:01:44,210 --> 00:01:47,919 And when you need to you can easily convert the c++ string into 34 00:01:47,920 --> 00:01:49,750 a c-style string and back again. 35 00:01:50,610 --> 00:01:54,410 Like vectors, c++ strings are safer since they provide methods 36 00:01:54,410 --> 00:01:57,480 that can bounce check and allow you to find errors in your code 37 00:01:57,480 --> 00:02:00,230 so you can fix them before your program goes into production. 38 00:02:00,940 --> 00:02:04,009 Let's see how we can declare and initialize c++ strings. 39 00:02:05,080 --> 00:02:08,250 In all the examples in this video, I'm assuming that the string header 40 00:02:08,250 --> 00:02:11,530 file has been included and that we're using the standard namespace. 41 00:02:12,780 --> 00:02:15,280 Here you can see six examples of declaration and 42 00:02:15,430 --> 00:02:17,390 initialization of c++ strings. 43 00:02:17,750 --> 00:02:21,149 There are other ways as well using constructor and assignment syntax. 44 00:02:21,490 --> 00:02:24,390 But I'm mainly using the initializer syntax in this video. 45 00:02:25,059 --> 00:02:27,670 In the first example, we declare S1 as a string. 46 00:02:27,870 --> 00:02:30,140 Notice that the string type is lowercase. 47 00:02:30,600 --> 00:02:34,639 Unlike c-style strings, c++ strings are always initialized. 48 00:02:34,860 --> 00:02:38,189 In this case, S1 is initialized to an empty string. 49 00:02:38,670 --> 00:02:40,729 No garbage and memory to have to worry about. 50 00:02:40,920 --> 00:02:43,759 In the second example, I'm declaring and initializing 51 00:02:44,390 --> 00:02:45,460 S2 to the string Frank. 52 00:02:45,890 --> 00:02:48,940 Notice that frank is a c-style literal, that's okay. 53 00:02:49,060 --> 00:02:51,319 It will be converted to a c++ string. 54 00:02:52,179 --> 00:02:56,140 In the third example, S3 is initialized from S2, so 55 00:02:56,140 --> 00:02:57,859 a copy of S2 is created. 56 00:02:58,279 --> 00:03:01,810 S2 and S3 will both be Frank, but different Franks in 57 00:03:01,810 --> 00:03:03,020 different areas of memory. 58 00:03:03,870 --> 00:03:08,120 In the fourth example, I'm declaring and initializing S4 from Frank. 59 00:03:08,620 --> 00:03:12,020 But I'm only using the first three characters of the string Frank. 60 00:03:12,220 --> 00:03:16,020 So S4 will be initialized to the string fra. 61 00:03:16,720 --> 00:03:21,320 In the fifth example, I'm initializing S5 from S3 which is Frank. 62 00:03:21,970 --> 00:03:25,230 But notice the two integers that follow the S3 and the initializer. 63 00:03:25,800 --> 00:03:29,530 The first integer is the starting index and the second is the length. 64 00:03:29,969 --> 00:03:33,780 So in this case, we initialize S5 with the two characters 65 00:03:33,780 --> 00:03:36,280 that index 0 and 1 from S3. 66 00:03:36,699 --> 00:03:39,230 So S5 will be initialized to fr. 67 00:03:39,530 --> 00:03:42,430 Finally, we can initialize the string to a specific number 68 00:03:42,450 --> 00:03:43,760 of a specific character. 69 00:03:44,330 --> 00:03:45,970 In this case, three x's. 70 00:03:46,520 --> 00:03:49,630 Note that this uses constructor syntax with the parentheses 71 00:03:49,630 --> 00:03:50,570 instead of the curlies. 72 00:03:51,469 --> 00:03:53,509 Now that we've declared some strings, let's see how we can 73 00:03:53,510 --> 00:03:54,950 assign other values to them. 74 00:03:56,960 --> 00:03:59,950 With c++ strings, you can use the assignment operator. 75 00:04:00,460 --> 00:04:02,820 This feels much more natural than having to use the stream 76 00:04:02,820 --> 00:04:05,840 copy function like we would have to in c-style strings. 77 00:04:06,469 --> 00:04:09,370 In this example, I've declared S1 and it's empty. 78 00:04:10,010 --> 00:04:13,739 Then I can assign the c-style literal c++ rocks to S1. 79 00:04:14,480 --> 00:04:15,720 Pretty cool and pretty easy. 80 00:04:16,240 --> 00:04:18,070 S1 will grow dynamically as needed. 81 00:04:18,690 --> 00:04:22,279 In the second example, I've declared S2 and initialized it to hello. 82 00:04:23,219 --> 00:04:25,200 Then I assign S1 to S2. 83 00:04:25,650 --> 00:04:28,099 In this case, S2 will no longer contain hello. 84 00:04:28,529 --> 00:04:31,850 It will contain a copy of S1, c++ rocks. 85 00:04:32,700 --> 00:04:34,900 Let's see how we can concatenate strings together. 86 00:04:36,720 --> 00:04:39,450 Concatenation of strings just means building up a string 87 00:04:39,450 --> 00:04:40,590 from two other strings. 88 00:04:41,179 --> 00:04:44,880 We can use the plus operator to concatenate c++ strings. 89 00:04:45,730 --> 00:04:49,970 In this example, I created two strings part one which is c++ 90 00:04:49,970 --> 00:04:51,830 and part two which is powerful. 91 00:04:52,660 --> 00:04:54,660 Then I have an empty string sentence. 92 00:04:55,000 --> 00:04:58,190 Notice that I'm assigning two sentence the concatenated result 93 00:04:58,210 --> 00:05:04,440 of part one plus a space plus part two plus a space plus language. 94 00:05:05,190 --> 00:05:10,090 If I displayed sentence now, it would display c++ is a powerful language. 95 00:05:11,010 --> 00:05:13,950 Notice that the last example on the slide will not compile. 96 00:05:14,400 --> 00:05:17,800 This is because we have two c-style literals. 97 00:05:18,469 --> 00:05:20,544 And you can't concatenate c-style literals. 98 00:05:20,740 --> 00:05:22,949 It only works for c++ strings. 99 00:05:23,350 --> 00:05:27,140 A combination of c++ strings and c-style strings is okay though as 100 00:05:27,140 --> 00:05:28,760 we saw in the previous assignments. 101 00:05:30,210 --> 00:05:33,030 Just like we did with vectors, we can use the same operators 102 00:05:33,030 --> 00:05:34,340 to access string elements. 103 00:05:35,110 --> 00:05:37,329 In this case, the elements of a string are characters. 104 00:05:37,590 --> 00:05:41,140 So we can use the subscript operator as well as the at method. 105 00:05:41,520 --> 00:05:44,140 Remember, the app method performs bounce checking. 106 00:05:44,370 --> 00:05:47,430 So if you go over bounds, you'll get an exception which you can fix. 107 00:05:48,170 --> 00:05:51,020 Let's see how we can display screen characters one at a time. 108 00:05:53,020 --> 00:05:56,209 In this example, we have a string S1 initialized to Frank. 109 00:05:56,639 --> 00:05:59,959 We can use the range based for loop to display the string characters. 110 00:06:00,240 --> 00:06:04,320 In this case, f-r-a-n-k and the null character will be displayed. 111 00:06:04,970 --> 00:06:06,550 Pretty much what you expected, right. 112 00:06:06,980 --> 00:06:10,160 Notice that the type of the loop variable is char in this case. 113 00:06:10,750 --> 00:06:13,049 What do you think will happen if we change that to integer. 114 00:06:14,940 --> 00:06:16,840 In this case, I've changed it to integer. 115 00:06:16,980 --> 00:06:18,129 Is this what you expected. 116 00:06:18,900 --> 00:06:22,370 We told the compiler to use an integer and that's exactly what it's doing. 117 00:06:22,850 --> 00:06:26,740 So instead of displaying the character value of each element in the string, 118 00:06:26,760 --> 00:06:30,699 it's displaying the integer value that represents those characters. 119 00:06:31,040 --> 00:06:38,880 So in this case, 70 114 97 110 107 and 0 which represent f r a n k 120 00:06:38,910 --> 00:06:40,410 and of course the null character. 121 00:06:41,160 --> 00:06:43,550 These are the ascii codes for those characters. 122 00:06:45,370 --> 00:06:48,930 Comparing c++ strings couldn't be any easier or more intuitive. 123 00:06:49,290 --> 00:06:51,899 We use the same equality and relational operators that 124 00:06:51,900 --> 00:06:53,050 we've been using all along. 125 00:06:54,020 --> 00:06:57,290 We're comparing two string objects, so they'll be compared character 126 00:06:57,290 --> 00:07:00,960 by character, and their character values will be compared lexically. 127 00:07:01,370 --> 00:07:05,840 So a capital a is less than a capital z, and a capital a 128 00:07:05,849 --> 00:07:07,500 is less than a lowercase a. 129 00:07:07,799 --> 00:07:10,599 That's because the capital letters come before the lowercase 130 00:07:10,619 --> 00:07:12,069 letters in the ascii table. 131 00:07:12,420 --> 00:07:16,000 We can't use these operators on two c-style literals, but we can 132 00:07:16,000 --> 00:07:17,470 use them in the following cases. 133 00:07:17,850 --> 00:07:23,059 If we have two c++ strings, if we have one c++ string and a c-style 134 00:07:23,059 --> 00:07:27,940 literal or if we have one c++ string and one c-style string. 135 00:07:28,600 --> 00:07:29,719 Let's see some examples. 136 00:07:30,699 --> 00:07:34,700 Here we're defining five c++ string variables, S1 through S5. 137 00:07:35,090 --> 00:07:38,140 And then we perform some comparison operations and see the results. 138 00:07:38,630 --> 00:07:41,349 Of course, you would normally use these Boolean expressions 139 00:07:41,349 --> 00:07:43,879 in an if statement or looping conditional expressions. 140 00:07:44,410 --> 00:07:48,310 In the first example, we check to see if S1 is equal to S5. 141 00:07:48,610 --> 00:07:51,159 This is true since they both contain the string apple. 142 00:07:52,280 --> 00:07:56,200 S1 equals S2 is false since S1 is apple and S2 is banana. 143 00:07:57,120 --> 00:07:59,260 How about S1 not equal to S2. 144 00:07:59,800 --> 00:08:02,579 This is true since apple is not equal to banana. 145 00:08:03,800 --> 00:08:09,990 In the case of S1 less than S2, this is also true since apple comes before 146 00:08:09,990 --> 00:08:12,130 banana lexically in the ascii table. 147 00:08:13,790 --> 00:08:18,610 S2 greater than S1 is also true since banana comes before apple lexically. 148 00:08:18,900 --> 00:08:22,730 Notice that banana has an uppercase b whereas apple has a lowercase a. 149 00:08:24,690 --> 00:08:28,150 S4 less than S5 is false since apple with a lowercase does not come 150 00:08:28,160 --> 00:08:29,830 before apple with an upper case. 151 00:08:30,790 --> 00:08:34,380 And then finally, A1 equal apple is true because they're the same. 152 00:08:35,049 --> 00:08:38,510 Notice in this case, apple is a c-style string literal. 153 00:08:40,730 --> 00:08:45,190 The c++ string class has a rich set of very useful methods, too many methods 154 00:08:45,190 --> 00:08:46,800 to cover in detail in this video. 155 00:08:47,110 --> 00:08:50,386 I encourage you to study the c++ string class since it's going 156 00:08:50,480 --> 00:08:53,329 to be a class that you'll use often, and it's important that 157 00:08:53,330 --> 00:08:55,640 you know what it provides, so you don't reinvent the wheel 158 00:08:55,640 --> 00:08:57,020 when you need to solve a problem. 159 00:08:57,740 --> 00:09:01,780 The substring method extracts a substring from a c++ string. 160 00:09:02,120 --> 00:09:03,400 It doesn't change the string. 161 00:09:03,410 --> 00:09:07,180 It simply returns the substring and you could do whatever you want with it. 162 00:09:07,480 --> 00:09:09,190 In this case, I'm simply displaying it. 163 00:09:09,559 --> 00:09:11,819 But you can easily assign it to a string variable. 164 00:09:12,400 --> 00:09:16,060 Here, I've initialized S1 to this is a string. 165 00:09:17,279 --> 00:09:20,939 The first example takes a substring of this string starting at index 0 166 00:09:21,310 --> 00:09:23,510 and including exactly 4 characters. 167 00:09:24,000 --> 00:09:27,199 If there are less than 4 characters left in the original string then all 168 00:09:27,200 --> 00:09:28,810 the remaining characters are included. 169 00:09:29,259 --> 00:09:32,459 In this case, the substring is the first word in the string, this. 170 00:09:33,790 --> 00:09:36,690 In the second example, we return the substring starting at index 171 00:09:36,690 --> 00:09:39,110 five and include two characters. 172 00:09:39,300 --> 00:09:41,500 That's the substring is, IS. 173 00:09:42,440 --> 00:09:46,500 Finally the last example starts at index 10 and includes four characters, 174 00:09:46,770 --> 00:09:48,780 this will return the substring test. 175 00:09:49,730 --> 00:09:51,690 Let's see how we can search a string for another. 176 00:09:53,020 --> 00:09:56,240 The c++ string class has a very handy method named find. 177 00:09:56,550 --> 00:09:58,760 Find works with characters and strings. 178 00:09:59,190 --> 00:10:03,079 It expects a string or character and returns the index or position 179 00:10:03,440 --> 00:10:06,440 of the beginning of that string or character in the original string. 180 00:10:06,860 --> 00:10:10,969 So if we have a string S1 that's initialized to this is a test and we 181 00:10:10,969 --> 00:10:16,969 want to find the string this, we'd get back a 0 since this starts at index 0. 182 00:10:17,920 --> 00:10:20,430 In the second example we're looking for the string is. 183 00:10:20,950 --> 00:10:25,250 In this case, it would return 2 since the first is starts at index 2. 184 00:10:26,549 --> 00:10:30,030 In the third example, we're finding the string test, and we get back a 10. 185 00:10:31,160 --> 00:10:34,930 In the fourth example, we're searching for a single character, the lowercase e, 186 00:10:35,190 --> 00:10:37,010 which is found at index 11. 187 00:10:37,780 --> 00:10:40,299 In the fifth example, we use a variant of the method that 188 00:10:40,300 --> 00:10:43,250 also allows the index where you want to start the search from. 189 00:10:43,910 --> 00:10:47,070 In this case, I want to find the is substring again. 190 00:10:47,440 --> 00:10:49,060 But I want to start at index 4. 191 00:10:49,330 --> 00:10:53,550 So this time it finds the is that's located at index 5. 192 00:10:53,550 --> 00:10:56,040 Finally, what happens if the string or character we want 193 00:10:56,040 --> 00:10:57,280 to find just isn't there. 194 00:10:57,650 --> 00:11:01,760 Well, in this case the method returns an end position, which means no 195 00:11:01,760 --> 00:11:03,690 position information available. 196 00:11:04,940 --> 00:11:07,150 You can check for this value in an if statement. 197 00:11:07,460 --> 00:11:10,120 And if true, you know what you were searching for wasn't there. 198 00:11:10,640 --> 00:11:12,130 Very easy, very powerful. 199 00:11:12,750 --> 00:11:16,899 There's also an r find method that starts searching from the end of the 200 00:11:16,900 --> 00:11:18,520 string to the beginning of the string. 201 00:11:19,929 --> 00:11:23,240 We can also remove characters from a c++ string using the 202 00:11:23,240 --> 00:11:24,689 erase and clear methods. 203 00:11:25,710 --> 00:11:28,260 For the erase method, you provide the starting index and 204 00:11:28,260 --> 00:11:29,620 how many characters to delete. 205 00:11:30,380 --> 00:11:33,110 The clear method deletes all the characters in the string so the 206 00:11:33,110 --> 00:11:34,630 string becomes the empty string. 207 00:11:35,980 --> 00:11:37,870 We've seen a lot of string methods and you can see 208 00:11:37,870 --> 00:11:39,379 how powerful this class is. 209 00:11:39,589 --> 00:11:42,219 Let's look at one more useful method and one more useful 210 00:11:42,219 --> 00:11:43,640 operator that are commonly used. 211 00:11:44,000 --> 00:11:45,530 The method is the length method. 212 00:11:45,910 --> 00:11:49,400 It returns the number of characters currently in the string object. 213 00:11:49,980 --> 00:11:51,910 In this example, S1 is Frank. 214 00:11:52,179 --> 00:11:54,780 So s1.length will return a 5. 215 00:11:55,230 --> 00:11:58,159 This is so easy and something that's impossible to do with c 216 00:11:58,160 --> 00:12:01,200 cell strings since they don't contain size information. 217 00:12:02,330 --> 00:12:05,530 The operator i wanted to cover is the compound concatenation 218 00:12:05,530 --> 00:12:06,600 assignment operator. 219 00:12:07,130 --> 00:12:08,900 In this case, S1 is Frank. 220 00:12:09,210 --> 00:12:12,050 And I can say S1 plus equals James. 221 00:12:12,759 --> 00:12:16,679 And James will be concatenated to Frank and the entire result 222 00:12:16,690 --> 00:12:19,030 string will be assigned back to S1. 223 00:12:19,520 --> 00:12:22,750 This is really handy and works very much the same way that the compound 224 00:12:22,760 --> 00:12:26,410 assignment operators worked with integers and doubles and so forth. 225 00:12:27,460 --> 00:12:30,650 There are also many more methods in the c++ string class for you 226 00:12:30,650 --> 00:12:32,819 to discover as you study c++. 227 00:12:33,600 --> 00:12:37,000 Okay, there's one more thing I'd like to talk about before we end this video, 228 00:12:37,310 --> 00:12:39,439 input with c++ strings. 229 00:12:40,820 --> 00:12:44,120 C++ strings work great with input and output streams. 230 00:12:44,690 --> 00:12:48,960 As you've seen, inserting c++ string variables to an output stream like 231 00:12:48,960 --> 00:12:52,329 cout is pretty easy and works just like we've been doing all along. 232 00:12:53,020 --> 00:12:57,449 Extracting a c++ string from an input stream like cin also 233 00:12:57,450 --> 00:12:59,079 works the same way we expect. 234 00:12:59,900 --> 00:13:03,429 However, there's one issue that's also true for c-style strings. 235 00:13:03,910 --> 00:13:08,190 Suppose we've defined S1 as a c++ string and we extract 236 00:13:08,190 --> 00:13:09,930 a string from cin as usual. 237 00:13:10,330 --> 00:13:13,150 Now suppose I type in hello space there. 238 00:13:13,830 --> 00:13:16,780 When I display S1, I will only see hello. 239 00:13:17,260 --> 00:13:18,900 The there was not extracted. 240 00:13:19,740 --> 00:13:22,089 This is because the extraction operator stops 241 00:13:22,090 --> 00:13:22,970 when it sees whitespace. 242 00:13:24,460 --> 00:13:28,100 In many cases, we want to read an entire line of text up to 243 00:13:28,100 --> 00:13:29,569 when the user presses enter. 244 00:13:30,260 --> 00:13:32,670 For example, I want the string to be hello there. 245 00:13:34,060 --> 00:13:36,069 Suppose I asked you to enter your full name. 246 00:13:36,370 --> 00:13:39,260 I want to be able to read William Smith, not just William. 247 00:13:39,920 --> 00:13:42,640 In this case, we can use the getlined function. 248 00:13:43,259 --> 00:13:45,640 The getline function has a couple of variants. 249 00:13:46,070 --> 00:13:48,580 The first variant expects two elements inside the parentheses. 250 00:13:49,700 --> 00:13:51,740 The first element is the input stream. 251 00:13:52,190 --> 00:13:55,480 In this case, we're using cin which defaults to the keyboard. 252 00:13:56,360 --> 00:13:59,959 The second element is the name of the c++ string where you want the 253 00:13:59,960 --> 00:14:01,990 text that the user enters stored. 254 00:14:02,559 --> 00:14:04,060 That's it. Very easy. 255 00:14:04,450 --> 00:14:08,920 In the example, I'm saying getline cin S1. 256 00:14:08,920 --> 00:14:11,640 Now everything the user types is stored into S1. 257 00:14:12,950 --> 00:14:15,430 Getline stops reading when it sees the new line. 258 00:14:15,430 --> 00:14:18,399 It doesn't include the new line in the string it just discards it. 259 00:14:19,580 --> 00:14:22,479 The other variant of getline has another element in the parentheses. 260 00:14:23,219 --> 00:14:26,010 The first two are the same as before, the input stream and 261 00:14:26,010 --> 00:14:27,800 the c++ string variable name. 262 00:14:28,520 --> 00:14:30,170 The third is called the delimiter. 263 00:14:30,410 --> 00:14:34,440 This is the character that you want getline to stop reading input at. 264 00:14:34,860 --> 00:14:38,010 So as long as the user doesn't enter this character, everything will 265 00:14:38,010 --> 00:14:39,409 be stored in the string variable. 266 00:14:39,880 --> 00:14:42,556 Once the delimiter is seen, it's not included in the string 267 00:14:42,556 --> 00:14:43,920 variable and it's discarded. 268 00:14:44,690 --> 00:14:48,440 In the last example, I'm using a lowercase x as the delimiter. 269 00:14:49,100 --> 00:14:53,739 So if i type this is x, then the string stored in S1 will be 270 00:14:53,759 --> 00:14:56,149 this is and the x is discarded. 271 00:14:57,410 --> 00:15:00,189 Well, we've covered a lot of material in this video, and there's much 272 00:15:00,199 --> 00:15:01,800 more in the string class to learn. 273 00:15:02,150 --> 00:15:04,470 But this gives you a good starting point so you can use 274 00:15:04,470 --> 00:15:06,600 the c++ string class effectively. 275 00:15:07,050 --> 00:15:10,200 Also you've now been introduced to object oriented programming 276 00:15:10,200 --> 00:15:12,060 with both vectors and strings. 277 00:15:12,400 --> 00:15:15,420 Pretty soon, we'll be developing our own classes which is pretty cool. 278 00:15:16,059 --> 00:15:17,309 That completes this video. 279 00:15:17,600 --> 00:15:18,970 Please play with the string class. 280 00:15:18,980 --> 00:15:22,380 Create examples, assign, delete, display and try out some of 281 00:15:22,380 --> 00:15:23,609 the methods in this video. 282 00:15:23,820 --> 00:15:25,939 It won't take long before you're really comfortable 283 00:15:25,940 --> 00:15:27,499 working with c++ strings.