1 00:00:00,090 --> 00:00:00,480 ‫All right. 2 00:00:00,480 --> 00:00:01,600 ‫So let's get started. 3 00:00:01,620 --> 00:00:04,110 ‫The first thing we have here, of course, is the main method. 4 00:00:04,110 --> 00:00:08,100 ‫And within the main method, we already have a console of right line statement. 5 00:00:08,100 --> 00:00:12,120 ‫But what we are going to need is a string. 6 00:00:12,120 --> 00:00:19,830 ‫And I'm just going to call the string my name and then I'm going to write something like, please enter 7 00:00:19,830 --> 00:00:21,600 ‫your name and press enter. 8 00:00:22,170 --> 00:00:22,530 ‫All right. 9 00:00:22,530 --> 00:00:28,260 ‫So we're not going to need this helloworld write statement and then I need to get the user input. 10 00:00:28,260 --> 00:00:29,930 ‫And how do we get the user input? 11 00:00:29,940 --> 00:00:32,490 ‫Well, we need to use red line for it. 12 00:00:32,490 --> 00:00:34,560 ‫So console dot red line. 13 00:00:34,590 --> 00:00:39,960 ‫This will allow us to get the user input and then store it in a variable. 14 00:00:39,960 --> 00:00:43,860 ‫And this is what the red line gives us as an output. 15 00:00:43,860 --> 00:00:49,470 ‫So the red line method, as you can see, once you hover over it, is going to return a string and that 16 00:00:49,470 --> 00:00:53,700 ‫string will be then stored in our my name variable, which is a string as well. 17 00:00:53,910 --> 00:01:02,580 ‫And then we can go ahead and convert that into an uppercase string very easily by using the following 18 00:01:02,580 --> 00:01:03,410 ‫line of code. 19 00:01:03,420 --> 00:01:11,760 ‫So you can see here, string my name, uppercase is going to be string format uppercase and then the 20 00:01:11,760 --> 00:01:13,680 ‫my name to upper. 21 00:01:13,680 --> 00:01:17,220 ‫So this method here called to upper as a string method. 22 00:01:17,220 --> 00:01:25,260 ‫So a method that we can apply to a string and it allows us then to basically make the whole statement 23 00:01:25,260 --> 00:01:26,730 ‫and uppercase statement. 24 00:01:27,180 --> 00:01:27,780 ‫All right. 25 00:01:27,780 --> 00:01:30,150 ‫So let's just test that real quick. 26 00:01:31,250 --> 00:01:35,240 ‫By displaying this my name uppercase in the console. 27 00:01:35,270 --> 00:01:36,590 ‫All right, so let's run it. 28 00:01:37,100 --> 00:01:37,900 ‫So there you are. 29 00:01:37,910 --> 00:01:40,460 ‫It says, please enter your name and press enter. 30 00:01:40,460 --> 00:01:44,300 ‫So I'm just going to say Dennis or let's do it correctly. 31 00:01:44,300 --> 00:01:46,010 ‫Then it's Panopto, that's my name. 32 00:01:46,190 --> 00:01:49,580 ‫And you can see uppercase Dennis pun user. 33 00:01:49,580 --> 00:01:54,620 ‫So the whole word for the whole string was made in uppercase string. 34 00:01:54,830 --> 00:01:55,400 ‫Okay. 35 00:01:55,940 --> 00:01:56,270 ‫All right. 36 00:01:56,270 --> 00:02:05,480 ‫So that was the first part now doing the same thing for lowercase and then also trimming and finally 37 00:02:05,510 --> 00:02:08,240 ‫just printing the substring. 38 00:02:08,240 --> 00:02:09,770 ‫Okay, let's do that real quick. 39 00:02:09,800 --> 00:02:12,560 ‫So here we have the three. 40 00:02:13,430 --> 00:02:14,310 ‫Examples. 41 00:02:14,330 --> 00:02:22,190 ‫So first of all, my name lowercase this will also use the format method and there we enter the text 42 00:02:22,190 --> 00:02:23,990 ‫or past the text lowercase. 43 00:02:23,990 --> 00:02:31,340 ‫And then here we use this curly brackets, zero curly brackets, which will then allow us to simply 44 00:02:31,340 --> 00:02:34,190 ‫display whatever comes after this comma here. 45 00:02:34,190 --> 00:02:36,710 ‫So in our case, it's going to be my name to lower. 46 00:02:36,710 --> 00:02:37,790 ‫So we take my name. 47 00:02:37,790 --> 00:02:45,200 ‫So whatever the user has entered in this line and then we will see that it will be a lowercase string. 48 00:02:45,200 --> 00:02:48,560 ‫So my name lowercase will be a lowercase string. 49 00:02:49,070 --> 00:02:51,350 ‫Then let's look at my name trimmed. 50 00:02:51,350 --> 00:02:54,740 ‫So let's say we enter something like empty space. 51 00:02:54,740 --> 00:02:57,200 ‫Dennis Empty space to empty space. 52 00:02:57,200 --> 00:03:01,790 ‫Then it would trim the empty spaces at the beginning and at the end. 53 00:03:01,790 --> 00:03:04,460 ‫And that's what this trim does. 54 00:03:04,460 --> 00:03:09,740 ‫So this trim method, my name Dot Trim and then my name substring. 55 00:03:09,770 --> 00:03:11,330 ‫That will give us the. 56 00:03:12,430 --> 00:03:16,780 ‫Here we're calling this method here called substring. 57 00:03:16,780 --> 00:03:22,030 ‫And what it will do is it will start at zero and we'll have a length of five. 58 00:03:22,030 --> 00:03:28,390 ‫So this will return the length of the string of five and start at the position zero. 59 00:03:28,390 --> 00:03:29,410 ‫So let's just test it. 60 00:03:29,410 --> 00:03:33,040 ‫Let's just try it and see what kind of result we will get. 61 00:03:33,040 --> 00:03:37,030 ‫And I'm going to add all of those missing lines here. 62 00:03:38,900 --> 00:03:45,820 ‫So what we can see here is that we're just writing all of those variables that we just created onto 63 00:03:45,830 --> 00:03:46,440 ‫the console. 64 00:03:46,460 --> 00:03:47,690 ‫So let's run it again. 65 00:03:47,870 --> 00:03:50,120 ‫So I'm going to enter empty space. 66 00:03:50,120 --> 00:03:51,830 ‫Dennis Pan, Utah. 67 00:03:51,830 --> 00:03:52,820 ‫Empty space. 68 00:03:53,390 --> 00:03:57,560 ‫You can see here, I changed it to Dennis Pan, Utah then. 69 00:03:57,710 --> 00:03:59,510 ‫And by the way, there is an empty space here. 70 00:03:59,510 --> 00:04:02,720 ‫When you click on it, you can see it, otherwise you cannot see it. 71 00:04:02,720 --> 00:04:04,220 ‫So that's really difficult here. 72 00:04:04,310 --> 00:04:06,680 ‫But you can see there are empty spaces afterwards as well. 73 00:04:06,680 --> 00:04:11,320 ‫But here for this case, I can see this this very first one is not an empty space. 74 00:04:11,330 --> 00:04:15,650 ‫This is just the empty space that we created here, this one. 75 00:04:15,650 --> 00:04:19,340 ‫But then the other one, that's the one that is interesting. 76 00:04:19,670 --> 00:04:21,710 ‫And it's this one that I entered. 77 00:04:21,710 --> 00:04:23,600 ‫So I also entered empty spaces. 78 00:04:23,600 --> 00:04:25,430 ‫And you can see here trim value. 79 00:04:25,430 --> 00:04:28,700 ‫There is no empty space that is inside of that string. 80 00:04:28,700 --> 00:04:35,810 ‫So the empty space before that was cut out, it was trimmed off the string and you can see the substring 81 00:04:35,810 --> 00:04:37,220 ‫value is Danny. 82 00:04:37,340 --> 00:04:39,350 ‫And why is it Danny and not Dennis? 83 00:04:39,710 --> 00:04:44,480 ‫Well, because the string that I entered was underscore Dennis. 84 00:04:44,600 --> 00:04:47,600 ‫And what we did with the substring here was. 85 00:04:48,390 --> 00:04:55,380 ‫We started at zero, which means we had the underscore and then we had a length of five. 86 00:04:55,380 --> 00:04:59,640 ‫So let's just have a look at this in this particular example here. 87 00:05:00,030 --> 00:05:06,630 ‫So we started with an underscore and then Dennis Pan to underscore. 88 00:05:06,660 --> 00:05:10,110 ‫So it starts at zero and it's a length of five. 89 00:05:10,110 --> 00:05:13,770 ‫So let's look at five characters and you can see it's those five characters. 90 00:05:13,770 --> 00:05:17,000 ‫So it's underscore the E and I. 91 00:05:17,460 --> 00:05:18,150 ‫That's it. 92 00:05:19,020 --> 00:05:19,440 ‫All right. 93 00:05:19,440 --> 00:05:20,940 ‫So that's it for this exercise. 94 00:05:20,940 --> 00:05:26,040 ‫I hope you tried and followed along and you finish this exercise yourself. 95 00:05:26,460 --> 00:05:26,820 ‫All right. 96 00:05:26,820 --> 00:05:29,790 ‫So thanks a lot and see you in the next video.