Come back in this lesson we're going to talk about strings that is essentially a set of characters sitting
next to each other and building a string of text.
So let's jump back to school.
You may explore them very close down this project and say fine.
New project this is going to be strings project these things are quite important.
They tackle a lot of the different things that we do in development and we should get a very good you
know sense of understanding and practice of them.
So the first thing I want to show you is this.
So far everything you have been doing you have actually been using strings.
This is a string and that is how it's being written.
So at sign quotations and then a string of characters.
So if I want to do that with say a string I'm going to call it my E-String is.
And then within the quotation marks I would write a string of characters.
I doesn't really matter if you make either spelling mistakes or whatever because this will be treated
as a string of values that you could do something with it.
For instance you could print it.
So let's see how you would do that.
I'm going to say I have a very Abair called my a string.
And then Indianness like in the print I'm going to say preens Maia's think so.
I have a string and I'm going to end this log in data value.
It's been done wrong.
Now in the build we have this thing a string of characters which is exactly what we had.
They are variable and now it's being shown in there.
But what if I change the value of a string.
What if I go ahead and say my string is actually going to be held instead of whatever it used to be
for.
So the next thing that we print is obviously going to print the most latest value that has been assigned
to my string and now it means hello for me.
Now this is a form out there and it's like preens values in a string variable.
And by that I mean that the value that gets printed inside and a slot the value that gets fed into in
a slide it will be printed as if it was in a string and that's the default behavior if you remember
we had and this long I was saying hello world.
And that's like the default behavior for the expects and insisting to be fed into it.
The whole world did things such as Hello world for integer and then we would feed an integer into it.
And that was type of formatting.
So let's talk about that for a second.
Let's see how we can for Maternus a string to show us different values as opposed to just text values
and they go up here.
I'm going to say integer Monnie integer is 32.
And then in this string I'm going to say instead of that are you which is just a static value.
Let's do this as a string string format.
And this is the first time we're seeing this thing and this is the first time we are actually using
a method.
This is essentially calling a method.
I'll talk about this much further in the future.
I'm going to say the format I want to use is this percentage and my integer.
Now what do you think this is going to do.
This is going to say there is a string value called my string.
It is formatted using an integer from this integer value.
So essentially my string is going to be Turi and 2.
It's an important distinction to make that is strange is not to read as hurty true.
It is read as surely as a letter not a number and to again as a letter.
If this was 30 to 65 8 9 that integer lovebird would read is as two hundred twenty six thousand five
hundred eighty nine which is exactly what makes sense but this 3:11 we would read this theory 2 6 5
8 9.
We will then read as a numeric value anymore because we are a format that is to become a string of text
and we removed that them will remove that buildup one again and it says it is 3 2 6 5 8 9.
Not a number.
Keep that in mind.
And there's an warning here for me and you can get rid of that warning by doing this.
You could say percentage at which is the object that is coming up.
Whatever is the object feeding into here.
The reason that is a warning is and it's like saying I'm not sure if the object you're feeding into
me is exactly the type that they need in here I'm saying find the object unprinted exactly the way it
is.
So once again I know I'm rushing through some of this content but this is just to build your confidence
and you get a better sense of you know different programming methods one step at a time.
These things will become second nature for you so don't worry overly about them.
Before I close this lesson however I should explain this R6 what it means and why we have that.
Why is it that when I'm making an integer on my end there is no asterisks except that I'm making and
this is throwing my a string.
There is an Asterix and also what is this n s in here.
So first thing first.
And as is essentially a formatting for different value names in Objective-C.
It has been removed from Swift and in the future you will just call this a string.
When we are using our strength.
But for now we can use an S on the best of my understanding and as it stands for next step and that's
the company that Apple purchased so many many years ago.
And also they got their programming technology with them but you can't just you know keep in mind that
most everything they have an end as the beginning of it.
And as aere my array and as mutable dictionary my dictionary so on and so forth these are things that
we'll see some time in actually in this lesson.
And this section actually.
So an S is for that and the asterisks essentially returns a pointer where the pointer is something that
we'll discuss in far more details in the future.
But it's essentially a place right is a space in memory because this thing could be a very long it takes
thing could be an entire book for instance.
Another very good idea but it could be in theory because it could be very long.
It's best if you place it somewhere in the memory and we get the location to that memory as opposed
to having the actual text within our code because otherwise the record is going to be quite slow.
So instead of actually accessing the value of the string we get the pointer to that space in the memory
where the text is whenever you want to show it.
We say well go to that memory space and fetch that value for us.
Except for the very basic primitive variables such as integer archive of floats and booleans.
Almost everything else needs an R6 as long as you are doing programming in Objective-C.
Once we move to see if this whole thing is illuminated but for now for most everything we are going
to be using on a which shows that it's memory space as a pointer to a memory space.
So that's about that quick to reach out and assess things.
They show us a string of there's a string of characters can be formatted different ways.
We could just simply be a set of characters in a string.
Are there strings and name of it is going to be.
This is my voice.
And now I could say and Aslaug what I copied out say preens other string as well.
And if you print you can imagine that down here you will get to see.
This is Iowas exactly what we have between the quotation marks.
So that's about that.
That's an introduction to strings in the next lesson.
We're going to work on an assignment based on the strengths.