1 00:00:01,660 --> 00:00:08,850 Come back in this lesson we're going to talk about strings that is essentially a set of characters sitting 2 00:00:08,850 --> 00:00:12,950 next to each other and building a string of text. 3 00:00:12,990 --> 00:00:16,480 So let's jump back to school. 4 00:00:16,530 --> 00:00:20,820 You may explore them very close down this project and say fine. 5 00:00:20,950 --> 00:00:29,780 New project this is going to be strings project these things are quite important. 6 00:00:29,790 --> 00:00:36,150 They tackle a lot of the different things that we do in development and we should get a very good you 7 00:00:36,150 --> 00:00:40,610 know sense of understanding and practice of them. 8 00:00:40,620 --> 00:00:44,430 So the first thing I want to show you is this. 9 00:00:44,430 --> 00:00:49,310 So far everything you have been doing you have actually been using strings. 10 00:00:49,320 --> 00:00:53,530 This is a string and that is how it's being written. 11 00:00:53,550 --> 00:00:57,930 So at sign quotations and then a string of characters. 12 00:00:57,930 --> 00:01:06,150 So if I want to do that with say a string I'm going to call it my E-String is. 13 00:01:07,080 --> 00:01:12,610 And then within the quotation marks I would write a string of characters. 14 00:01:12,660 --> 00:01:19,560 I doesn't really matter if you make either spelling mistakes or whatever because this will be treated 15 00:01:19,650 --> 00:01:23,790 as a string of values that you could do something with it. 16 00:01:23,790 --> 00:01:25,770 For instance you could print it. 17 00:01:25,830 --> 00:01:27,750 So let's see how you would do that. 18 00:01:27,750 --> 00:01:31,510 I'm going to say I have a very Abair called my a string. 19 00:01:31,770 --> 00:01:39,020 And then Indianness like in the print I'm going to say preens Maia's think so. 20 00:01:39,290 --> 00:01:43,720 I have a string and I'm going to end this log in data value. 21 00:01:44,090 --> 00:01:45,560 It's been done wrong. 22 00:01:54,420 --> 00:02:02,300 Now in the build we have this thing a string of characters which is exactly what we had. 23 00:02:02,300 --> 00:02:06,500 They are variable and now it's being shown in there. 24 00:02:06,540 --> 00:02:09,130 But what if I change the value of a string. 25 00:02:09,140 --> 00:02:18,290 What if I go ahead and say my string is actually going to be held instead of whatever it used to be 26 00:02:18,320 --> 00:02:18,800 for. 27 00:02:18,950 --> 00:02:25,190 So the next thing that we print is obviously going to print the most latest value that has been assigned 28 00:02:25,610 --> 00:02:29,350 to my string and now it means hello for me. 29 00:02:29,390 --> 00:02:37,570 Now this is a form out there and it's like preens values in a string variable. 30 00:02:37,880 --> 00:02:44,000 And by that I mean that the value that gets printed inside and a slot the value that gets fed into in 31 00:02:44,040 --> 00:02:51,230 a slide it will be printed as if it was in a string and that's the default behavior if you remember 32 00:02:51,230 --> 00:02:55,630 we had and this long I was saying hello world. 33 00:02:55,790 --> 00:03:00,680 And that's like the default behavior for the expects and insisting to be fed into it. 34 00:03:00,740 --> 00:03:09,090 The whole world did things such as Hello world for integer and then we would feed an integer into it. 35 00:03:09,260 --> 00:03:11,480 And that was type of formatting. 36 00:03:11,660 --> 00:03:13,640 So let's talk about that for a second. 37 00:03:13,650 --> 00:03:21,650 Let's see how we can for Maternus a string to show us different values as opposed to just text values 38 00:03:21,910 --> 00:03:23,550 and they go up here. 39 00:03:23,620 --> 00:03:30,730 I'm going to say integer Monnie integer is 32. 40 00:03:31,190 --> 00:03:38,520 And then in this string I'm going to say instead of that are you which is just a static value. 41 00:03:38,780 --> 00:03:44,320 Let's do this as a string string format. 42 00:03:44,650 --> 00:03:49,100 And this is the first time we're seeing this thing and this is the first time we are actually using 43 00:03:49,550 --> 00:03:50,660 a method. 44 00:03:50,660 --> 00:03:52,970 This is essentially calling a method. 45 00:03:52,970 --> 00:03:56,170 I'll talk about this much further in the future. 46 00:03:56,420 --> 00:04:04,600 I'm going to say the format I want to use is this percentage and my integer. 47 00:04:04,610 --> 00:04:06,800 Now what do you think this is going to do. 48 00:04:06,800 --> 00:04:11,100 This is going to say there is a string value called my string. 49 00:04:11,180 --> 00:04:17,880 It is formatted using an integer from this integer value. 50 00:04:18,020 --> 00:04:22,890 So essentially my string is going to be Turi and 2. 51 00:04:23,120 --> 00:04:29,730 It's an important distinction to make that is strange is not to read as hurty true. 52 00:04:29,810 --> 00:04:37,710 It is read as surely as a letter not a number and to again as a letter. 53 00:04:37,790 --> 00:04:47,690 If this was 30 to 65 8 9 that integer lovebird would read is as two hundred twenty six thousand five 54 00:04:47,690 --> 00:04:58,580 hundred eighty nine which is exactly what makes sense but this 3:11 we would read this theory 2 6 5 55 00:04:58,670 --> 00:04:59,830 8 9. 56 00:04:59,940 --> 00:05:06,830 We will then read as a numeric value anymore because we are a format that is to become a string of text 57 00:05:07,280 --> 00:05:21,540 and we removed that them will remove that buildup one again and it says it is 3 2 6 5 8 9. 58 00:05:21,550 --> 00:05:23,410 Not a number. 59 00:05:23,410 --> 00:05:24,520 Keep that in mind. 60 00:05:24,610 --> 00:05:29,500 And there's an warning here for me and you can get rid of that warning by doing this. 61 00:05:29,500 --> 00:05:34,860 You could say percentage at which is the object that is coming up. 62 00:05:34,960 --> 00:05:38,100 Whatever is the object feeding into here. 63 00:05:38,110 --> 00:05:43,600 The reason that is a warning is and it's like saying I'm not sure if the object you're feeding into 64 00:05:43,630 --> 00:05:49,930 me is exactly the type that they need in here I'm saying find the object unprinted exactly the way it 65 00:05:49,930 --> 00:05:50,680 is. 66 00:05:50,680 --> 00:05:57,490 So once again I know I'm rushing through some of this content but this is just to build your confidence 67 00:05:57,490 --> 00:06:03,220 and you get a better sense of you know different programming methods one step at a time. 68 00:06:03,220 --> 00:06:08,320 These things will become second nature for you so don't worry overly about them. 69 00:06:08,740 --> 00:06:15,310 Before I close this lesson however I should explain this R6 what it means and why we have that. 70 00:06:15,310 --> 00:06:20,740 Why is it that when I'm making an integer on my end there is no asterisks except that I'm making and 71 00:06:20,740 --> 00:06:22,930 this is throwing my a string. 72 00:06:22,930 --> 00:06:27,110 There is an Asterix and also what is this n s in here. 73 00:06:27,460 --> 00:06:28,850 So first thing first. 74 00:06:28,900 --> 00:06:34,820 And as is essentially a formatting for different value names in Objective-C. 75 00:06:34,830 --> 00:06:40,270 It has been removed from Swift and in the future you will just call this a string. 76 00:06:40,330 --> 00:06:42,210 When we are using our strength. 77 00:06:42,370 --> 00:06:49,660 But for now we can use an S on the best of my understanding and as it stands for next step and that's 78 00:06:49,660 --> 00:06:53,510 the company that Apple purchased so many many years ago. 79 00:06:53,710 --> 00:06:59,770 And also they got their programming technology with them but you can't just you know keep in mind that 80 00:06:59,770 --> 00:07:03,250 most everything they have an end as the beginning of it. 81 00:07:03,400 --> 00:07:13,360 And as aere my array and as mutable dictionary my dictionary so on and so forth these are things that 82 00:07:13,360 --> 00:07:17,020 we'll see some time in actually in this lesson. 83 00:07:17,080 --> 00:07:18,500 And this section actually. 84 00:07:18,700 --> 00:07:27,640 So an S is for that and the asterisks essentially returns a pointer where the pointer is something that 85 00:07:27,640 --> 00:07:31,250 we'll discuss in far more details in the future. 86 00:07:31,270 --> 00:07:41,230 But it's essentially a place right is a space in memory because this thing could be a very long it takes 87 00:07:41,490 --> 00:07:44,020 thing could be an entire book for instance. 88 00:07:44,020 --> 00:07:48,940 Another very good idea but it could be in theory because it could be very long. 89 00:07:48,940 --> 00:07:55,480 It's best if you place it somewhere in the memory and we get the location to that memory as opposed 90 00:07:55,480 --> 00:08:01,490 to having the actual text within our code because otherwise the record is going to be quite slow. 91 00:08:01,510 --> 00:08:08,830 So instead of actually accessing the value of the string we get the pointer to that space in the memory 92 00:08:09,130 --> 00:08:11,900 where the text is whenever you want to show it. 93 00:08:11,920 --> 00:08:16,830 We say well go to that memory space and fetch that value for us. 94 00:08:17,020 --> 00:08:24,430 Except for the very basic primitive variables such as integer archive of floats and booleans. 95 00:08:24,430 --> 00:08:31,170 Almost everything else needs an R6 as long as you are doing programming in Objective-C. 96 00:08:31,280 --> 00:08:36,700 Once we move to see if this whole thing is illuminated but for now for most everything we are going 97 00:08:36,700 --> 00:08:44,980 to be using on a which shows that it's memory space as a pointer to a memory space. 98 00:08:45,220 --> 00:08:49,840 So that's about that quick to reach out and assess things. 99 00:08:49,840 --> 00:08:56,200 They show us a string of there's a string of characters can be formatted different ways. 100 00:08:56,250 --> 00:09:01,180 We could just simply be a set of characters in a string. 101 00:09:01,220 --> 00:09:05,600 Are there strings and name of it is going to be. 102 00:09:05,710 --> 00:09:08,080 This is my voice. 103 00:09:08,180 --> 00:09:15,700 And now I could say and Aslaug what I copied out say preens other string as well. 104 00:09:15,910 --> 00:09:19,900 And if you print you can imagine that down here you will get to see. 105 00:09:19,900 --> 00:09:25,650 This is Iowas exactly what we have between the quotation marks. 106 00:09:25,750 --> 00:09:27,150 So that's about that. 107 00:09:27,160 --> 00:09:30,300 That's an introduction to strings in the next lesson. 108 00:09:30,310 --> 00:09:33,690 We're going to work on an assignment based on the strengths.