OK, here we are back in the code.
Need I say I've copied the started up again, so let's do a couple of things just to get going.
So as I mentioned, we could do something like Cotswold Log.
Hello, world, and then we can do something with that, like I said, that length.
So let's just stipulate that we can have a literal string that we can do method's with or we can have
a string variable that we can do in methods with.
So then I can just turn around and say let hello equals.
I don't want to say hello because that's the name of the function.
Hello w equals hello world.
And I say cancel that log.
Hello W and those are going to give the exact same result if I say that line.
So let's just give that a try, so run how a world 11 and 11, so both 11 and like.
So let's look at a couple of things before we dive into the methods.
Let's look at the templating and using the plus sign operator to need strength.
So here's one way to concatenate strings.
We can say, well, hello to equals and we use the templating this little tactic and we'll say, let's
define some variables first.
Let's part one equals a low blood, part two equals world.
So then here I will say our message is
part one.
I'll put it the space,
part two.
And then since it's kind of a sentence, I'll put in a period and then I'm going to cancel that out.
And let's comment is out.
All right.
Our messages, hello, world, so then the next way we could do the exact same thing is with concatenation
using the plus an operator.
So in this one we're going to say hello three equals and I'll use regular quotes.
Our message is plus part one.
Plus we want a space plus part two in a period.
So it's going to give us the same result.
So this is a little bit older.
The plus concatenation, I think has been there all along and the templating is a little bit newer.
So it's a little bit more succinct and lets you be a little bit more flexible with how you put strings
together.
So let's.
And we got the exact same story.
All right, this is all well and good now.
Let's take a look at some of the methods.
I'm going to skip a few and do some of the more important ones.
So I'm going to take a copy, this one.
And and what Kosner, some of the uncommented all these stars say, but hello Rothko's hello world,
and then let's try saying constant dialogue.
Hello world that starts with.
And when you do these, you can see that there's often more parameters than what I'm maybe mentioning.
So the search string and then there's also a position I can tell where to start searching.
Starts with, but let's use the position or take
a position, one, I wouldn't start with a position zero because that starts with an H,
which was a work.
So true, if I said starts with a lower position one.
We get a false.
All right, let's let's let's skip down to the padding I have includes an index of the last index up
there, fairly similar.
So we'll say cancel that log.
First thing I notice is that the string is not changed when I do this, when I say Head Start
and I say let's say 30 and we'll put it in a time.
Or run this and then you can see the whole world has been padded so that 11 of the characters in the
string plus make up 30 characters.
Now, I'll show you why I will say that is true, that it didn't change the actual string, because
what we do is copy this and say let's do the same thing except at the end.
Now we have hello world at the end, Petitt at the start, and we have padding at the end, but you
can see that the original strength did not get changed.
All right, let's come at these out of hello, world.
And that's what will try to repeat
and I'll just say hello, world repeat
and how many say 10.
So just repeating it 10 times,
how about that slice, the name to me is always a little bit confusing.
So if I say Slice counseled out loud a little world that slice
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
before the end position.
So if I want to start a position to which is the L and I want to go low position zero one, two, three,
four.
I want it to end position five.
Hello, and then let's try one more, let's try to mark, because the trim is really useful sometimes
because people type things in and they put in whitespace and you want to get rid of it.
But let's do the two lowercase or two uppercase first.
So say that log.
Hello, world that to uppercase.
The first thing it does.
There's also two local uppercase and that's if a local has a specific uppercase rules that you want
to follow, like in France or something like that.
So I'll just say to uppercase and I'm going to repeat this and say to lowercase.
All right, Pam.
And you see, we have our uppercase, lowercase hello, world.
All right, finally, if we have a string that has some extra spaces in it, like with space string
equals Hello
World, and we want to get rid of those spaces, either the beginning, the end or all around we trim.
So if I say council that log space string that trim.
Now, first of all, it might be hard to tell because spaces don't show up that well on a console.
So what we do is just put like a vertical bar before and after.
So let's start out by not trimming it.
So let's just run that.
So we've got spaces before and after.
All right, let's try the three variations, so I'll say that from start.
That term and and just that term.
There we go, get the space from the start of space to turn from the end and all the space ostrum from
either end.
All right, so that's our introduction to strength's, we're going to be using them a lot as we move
forward, so we will be trying other things out as needed.