1 00:00:02,940 --> 00:00:05,040 OK, here we are back in the code. 2 00:00:05,400 --> 00:00:11,110 Need I say I've copied the started up again, so let's do a couple of things just to get going. 3 00:00:11,790 --> 00:00:15,540 So as I mentioned, we could do something like Cotswold Log. 4 00:00:18,950 --> 00:00:25,130 Hello, world, and then we can do something with that, like I said, that length. 5 00:00:27,590 --> 00:00:32,540 So let's just stipulate that we can have a literal string that we can do method's with or we can have 6 00:00:32,540 --> 00:00:34,520 a string variable that we can do in methods with. 7 00:00:35,120 --> 00:00:41,080 So then I can just turn around and say let hello equals. 8 00:00:41,110 --> 00:00:43,040 I don't want to say hello because that's the name of the function. 9 00:00:43,610 --> 00:00:49,310 Hello w equals hello world. 10 00:00:51,680 --> 00:00:54,230 And I say cancel that log. 11 00:00:56,090 --> 00:01:02,070 Hello W and those are going to give the exact same result if I say that line. 12 00:01:05,920 --> 00:01:14,080 So let's just give that a try, so run how a world 11 and 11, so both 11 and like. 13 00:01:15,160 --> 00:01:18,600 So let's look at a couple of things before we dive into the methods. 14 00:01:19,180 --> 00:01:24,010 Let's look at the templating and using the plus sign operator to need strength. 15 00:01:25,520 --> 00:01:27,550 So here's one way to concatenate strings. 16 00:01:27,550 --> 00:01:39,760 We can say, well, hello to equals and we use the templating this little tactic and we'll say, let's 17 00:01:39,760 --> 00:01:41,050 define some variables first. 18 00:01:43,510 --> 00:01:55,570 Let's part one equals a low blood, part two equals world. 19 00:01:58,480 --> 00:02:04,690 So then here I will say our message is 20 00:02:09,070 --> 00:02:09,820 part one. 21 00:02:11,740 --> 00:02:12,850 I'll put it the space, 22 00:02:18,040 --> 00:02:18,730 part two. 23 00:02:20,320 --> 00:02:26,920 And then since it's kind of a sentence, I'll put in a period and then I'm going to cancel that out. 24 00:02:34,690 --> 00:02:38,070 And let's comment is out. 25 00:02:40,780 --> 00:02:41,140 All right. 26 00:02:47,890 --> 00:02:54,370 Our messages, hello, world, so then the next way we could do the exact same thing is with concatenation 27 00:02:54,370 --> 00:02:55,820 using the plus an operator. 28 00:02:57,280 --> 00:03:03,550 So in this one we're going to say hello three equals and I'll use regular quotes. 29 00:03:04,030 --> 00:03:10,060 Our message is plus part one. 30 00:03:11,410 --> 00:03:18,430 Plus we want a space plus part two in a period. 31 00:03:19,720 --> 00:03:21,130 So it's going to give us the same result. 32 00:03:21,640 --> 00:03:23,380 So this is a little bit older. 33 00:03:23,710 --> 00:03:30,960 The plus concatenation, I think has been there all along and the templating is a little bit newer. 34 00:03:30,970 --> 00:03:36,820 So it's a little bit more succinct and lets you be a little bit more flexible with how you put strings 35 00:03:36,820 --> 00:03:37,210 together. 36 00:03:39,030 --> 00:03:39,700 So let's. 37 00:03:51,390 --> 00:03:52,710 And we got the exact same story. 38 00:03:56,970 --> 00:03:58,830 All right, this is all well and good now. 39 00:03:58,880 --> 00:04:00,720 Let's take a look at some of the methods. 40 00:04:03,000 --> 00:04:06,480 I'm going to skip a few and do some of the more important ones. 41 00:04:07,410 --> 00:04:12,690 So I'm going to take a copy, this one. 42 00:04:18,290 --> 00:04:29,440 And and what Kosner, some of the uncommented all these stars say, but hello Rothko's hello world, 43 00:04:30,620 --> 00:04:34,340 and then let's try saying constant dialogue. 44 00:04:35,870 --> 00:04:39,560 Hello world that starts with. 45 00:04:42,320 --> 00:04:46,690 And when you do these, you can see that there's often more parameters than what I'm maybe mentioning. 46 00:04:47,180 --> 00:04:51,500 So the search string and then there's also a position I can tell where to start searching. 47 00:04:54,220 --> 00:04:58,980 Starts with, but let's use the position or take 48 00:05:01,910 --> 00:05:08,470 a position, one, I wouldn't start with a position zero because that starts with an H, 49 00:05:12,830 --> 00:05:13,810 which was a work. 50 00:05:16,310 --> 00:05:21,680 So true, if I said starts with a lower position one. 51 00:05:27,410 --> 00:05:28,190 We get a false. 52 00:05:33,230 --> 00:05:40,850 All right, let's let's let's skip down to the padding I have includes an index of the last index up 53 00:05:40,850 --> 00:05:41,980 there, fairly similar. 54 00:05:43,610 --> 00:05:47,630 So we'll say cancel that log. 55 00:05:52,750 --> 00:05:58,900 First thing I notice is that the string is not changed when I do this, when I say Head Start 56 00:06:02,950 --> 00:06:10,330 and I say let's say 30 and we'll put it in a time. 57 00:06:18,420 --> 00:06:26,340 Or run this and then you can see the whole world has been padded so that 11 of the characters in the 58 00:06:26,340 --> 00:06:29,410 string plus make up 30 characters. 59 00:06:31,530 --> 00:06:37,410 Now, I'll show you why I will say that is true, that it didn't change the actual string, because 60 00:06:37,420 --> 00:06:41,250 what we do is copy this and say let's do the same thing except at the end. 61 00:06:49,760 --> 00:06:55,220 Now we have hello world at the end, Petitt at the start, and we have padding at the end, but you 62 00:06:55,220 --> 00:06:57,410 can see that the original strength did not get changed. 63 00:06:58,790 --> 00:07:02,300 All right, let's come at these out of hello, world. 64 00:07:06,380 --> 00:07:07,880 And that's what will try to repeat 65 00:07:11,840 --> 00:07:15,950 and I'll just say hello, world repeat 66 00:07:19,850 --> 00:07:21,860 and how many say 10. 67 00:07:30,790 --> 00:07:32,520 So just repeating it 10 times, 68 00:07:36,880 --> 00:07:40,080 how about that slice, the name to me is always a little bit confusing. 69 00:07:41,260 --> 00:07:49,960 So if I say Slice counseled out loud a little world that slice 70 00:07:52,570 --> 00:08:04,030 to start in the end, so I'll say start a position to when I say and it's the end position and it stops 71 00:08:04,030 --> 00:08:05,150 before the end position. 72 00:08:05,170 --> 00:08:13,510 So if I want to start a position to which is the L and I want to go low position zero one, two, three, 73 00:08:13,510 --> 00:08:14,140 four. 74 00:08:14,590 --> 00:08:16,390 I want it to end position five. 75 00:08:25,540 --> 00:08:33,100 Hello, and then let's try one more, let's try to mark, because the trim is really useful sometimes 76 00:08:34,570 --> 00:08:38,590 because people type things in and they put in whitespace and you want to get rid of it. 77 00:08:39,160 --> 00:08:41,950 But let's do the two lowercase or two uppercase first. 78 00:08:42,400 --> 00:08:44,320 So say that log. 79 00:08:47,550 --> 00:08:52,180 Hello, world that to uppercase. 80 00:08:52,190 --> 00:08:52,900 The first thing it does. 81 00:08:52,930 --> 00:09:01,600 There's also two local uppercase and that's if a local has a specific uppercase rules that you want 82 00:09:01,600 --> 00:09:04,920 to follow, like in France or something like that. 83 00:09:06,040 --> 00:09:10,660 So I'll just say to uppercase and I'm going to repeat this and say to lowercase. 84 00:09:20,000 --> 00:09:20,950 All right, Pam. 85 00:09:24,970 --> 00:09:27,400 And you see, we have our uppercase, lowercase hello, world. 86 00:09:28,450 --> 00:09:36,970 All right, finally, if we have a string that has some extra spaces in it, like with space string 87 00:09:37,240 --> 00:09:40,420 equals Hello 88 00:09:43,570 --> 00:09:51,080 World, and we want to get rid of those spaces, either the beginning, the end or all around we trim. 89 00:09:52,060 --> 00:10:00,720 So if I say council that log space string that trim. 90 00:10:01,840 --> 00:10:08,570 Now, first of all, it might be hard to tell because spaces don't show up that well on a console. 91 00:10:09,400 --> 00:10:12,230 So what we do is just put like a vertical bar before and after. 92 00:10:13,930 --> 00:10:17,200 So let's start out by not trimming it. 93 00:10:26,670 --> 00:10:27,700 So let's just run that. 94 00:10:31,030 --> 00:10:32,710 So we've got spaces before and after. 95 00:10:33,670 --> 00:10:42,130 All right, let's try the three variations, so I'll say that from start. 96 00:10:47,050 --> 00:10:51,610 That term and and just that term. 97 00:10:59,050 --> 00:11:05,350 There we go, get the space from the start of space to turn from the end and all the space ostrum from 98 00:11:05,350 --> 00:11:05,890 either end. 99 00:11:09,180 --> 00:11:12,720 All right, so that's our introduction to strength's, we're going to be using them a lot as we move 100 00:11:12,720 --> 00:11:16,550 forward, so we will be trying other things out as needed.