1 00:00:00,660 --> 00:00:01,580 ‫Welcome back. 2 00:00:01,590 --> 00:00:06,780 ‫And this video we are going to cover string and string is used for text. 3 00:00:06,780 --> 00:00:14,220 ‫So I showed you how to use string in one of the earlier videos and we use string as a capital letter 4 00:00:14,220 --> 00:00:16,740 ‫in order to get the class system string. 5 00:00:16,740 --> 00:00:25,680 ‫So we have a variable of type string and I'm going to call it my name and it's equal to Dennis, for 6 00:00:25,680 --> 00:00:26,490 ‫example. 7 00:00:26,820 --> 00:00:34,200 ‫Now you can use string with a capital letter, which is the class, or you could use string with a small 8 00:00:34,200 --> 00:00:38,910 ‫letter and the coding standard is to use a small letter. 9 00:00:38,910 --> 00:00:40,500 ‫So uncapitalized. 10 00:00:40,500 --> 00:00:46,080 ‫SW All right, so now let's go ahead and have a look at what we can do with strings. 11 00:00:46,080 --> 00:00:48,780 ‫We can, for example, print them out onto the console. 12 00:00:49,050 --> 00:00:52,410 ‫So write line or write right red line here. 13 00:00:52,410 --> 00:00:58,230 ‫And I'm going to enter my name and I'm going to simply read that. 14 00:00:58,230 --> 00:01:02,970 ‫So read and let's go ahead and start that. 15 00:01:04,110 --> 00:01:08,700 ‫And then it says, Dennis, we can use concatenation with strings. 16 00:01:08,700 --> 00:01:18,870 ‫So for example, instead of just writing Dennis, I could say something like my name is and then plus 17 00:01:19,110 --> 00:01:23,460 ‫the string, so you can add strings to each other, which means concatenation. 18 00:01:23,460 --> 00:01:29,430 ‫So which is called concatenation, which means you simply add strings up to be one string. 19 00:01:29,430 --> 00:01:34,050 ‫So that would be one whole string here, which is called My name is my name. 20 00:01:34,080 --> 00:01:39,420 ‫Or you could even go ahead and create a new string and call it message. 21 00:01:39,420 --> 00:01:43,890 ‫And it's going to be my name is 22 00:01:46,230 --> 00:01:47,970 ‫plus my name. 23 00:01:48,660 --> 00:01:54,510 ‫So you could go ahead like that as well and simply replace that statement with message. 24 00:01:55,170 --> 00:01:56,490 ‫So if I run that. 25 00:01:57,560 --> 00:01:58,010 ‫I get. 26 00:01:58,010 --> 00:01:59,420 ‫My name is Dennis. 27 00:02:01,200 --> 00:02:07,520 ‫And String is written with a small letter here, but as you can see, it's from the class system dot 28 00:02:07,530 --> 00:02:08,100 ‫string. 29 00:02:08,100 --> 00:02:15,090 ‫So within the system namespace there is a class called string and that class has multiple methods and 30 00:02:15,090 --> 00:02:21,360 ‫whenever we use it for variables, the coding standard is to use a small capital string. 31 00:02:21,360 --> 00:02:24,480 ‫But the class itself, as I said earlier, is a string. 32 00:02:25,140 --> 00:02:32,010 ‫But at the same time, what we can do now is, for example, with our message we can still use the string 33 00:02:32,220 --> 00:02:33,420 ‫class methods. 34 00:02:33,420 --> 00:02:40,440 ‫So the string has multiple methods and properties very similarly to what we have seen with console. 35 00:02:40,440 --> 00:02:46,440 ‫So we had seen that console actually have to get rid of that. 36 00:02:46,440 --> 00:02:55,440 ‫So console dot and as you can see there are plenty of properties, events and methods and the same thing 37 00:02:55,440 --> 00:02:58,140 ‫goes for strings. 38 00:02:58,320 --> 00:03:01,020 ‫So the message is of type string. 39 00:03:01,020 --> 00:03:09,660 ‫So now I can use the string methods onto that variable so I can for example, go to two upper. 40 00:03:09,660 --> 00:03:15,930 ‫I can use the two upper method which returns a copy of the string converted to uppercase. 41 00:03:15,930 --> 00:03:18,240 ‫So I'm just going to do that real quick. 42 00:03:18,240 --> 00:03:22,200 ‫And in order to store that somewhere, I need to create a new string. 43 00:03:22,200 --> 00:03:24,060 ‫So I'm going to call it caps. 44 00:03:24,060 --> 00:03:28,710 ‫Message is equal to message to upper. 45 00:03:31,260 --> 00:03:38,580 ‫And now let's return to Cap's message here, or let's write the Caps message onto our console, just 46 00:03:38,580 --> 00:03:40,170 ‫so you know what it does. 47 00:03:40,170 --> 00:03:40,950 ‫So there you are. 48 00:03:40,980 --> 00:03:43,560 ‫My name is Dennis and all in caps. 49 00:03:43,650 --> 00:03:48,180 ‫So that's what we can do with some of the string methods. 50 00:03:48,180 --> 00:03:49,980 ‫So there are plenty of other string methods. 51 00:03:49,980 --> 00:03:52,350 ‫So please go ahead and just check out some. 52 00:03:52,680 --> 00:04:01,740 ‫For example, please go ahead and create a new variable which is of type string and make it so that 53 00:04:01,740 --> 00:04:09,060 ‫the message is all with lowercase letters and then also print it out on the console. 54 00:04:11,120 --> 00:04:11,600 ‫All right. 55 00:04:11,600 --> 00:04:12,650 ‫I hope you tried it. 56 00:04:13,040 --> 00:04:20,810 ‫String lower case message is message dot two lower. 57 00:04:23,780 --> 00:04:26,320 ‫And now let's print it out. 58 00:04:26,330 --> 00:04:27,740 ‫A lower case message. 59 00:04:28,100 --> 00:04:29,990 ‫Let's write it onto our console. 60 00:04:29,990 --> 00:04:33,890 ‫And as you can see, my name is Dennis, all with lowercase. 61 00:04:35,800 --> 00:04:36,310 ‫All right. 62 00:04:36,310 --> 00:04:42,550 ‫So now you have seen how you can create strings, how you can use strings, and you have seen that there 63 00:04:42,550 --> 00:04:48,000 ‫are multiple methods that you can use and there are plenty more which we will use along the way. 64 00:04:48,010 --> 00:04:50,440 ‫But for now I think that's a good start. 65 00:04:50,440 --> 00:04:54,550 ‫And in the next video, we are going to have a look at naming conventions. 66 00:04:54,550 --> 00:04:55,870 ‫So see you there.