Programming Basics #29 Patterns in Strings

http://learn-share.net/programming-basics-course/
Programming Course. The Basics of Programming.
#29 Patterns in Strings

Learn to code.

Finding patterns in strings

Strings are smart. They tell things about them selfs. They have behaviour.

As an example to this, if i a create a variable called phrase. And give this simple value,i can use the name of the variable, follow with a dot, and then i can access certain built in information about it.

So i’m using this dot length, what’s called a property.
To access this fact that this is 24 letters long, piping up an alert box.

But it also have behavior.
And we can use the same dot operator to get to them.

Strings have what it called, methods.
And this are like functions. We already see functions, we call them in parenthesis. But methods are unlike functions, they belong to a string.

So again if we create a variable called phrase, we can use phrase dot, and then some built in methods like, to upper case, which i’m calling like a function, using parenthesis after it.

And since we have this in to an alert box, we get that string, converted to upper case.

Published
Categorized as Videos