WEBVTT

00:01.330 --> 00:07.550
One of the greatest features that was released in Essex and actually one of my favorites is tablet strength.

00:08.410 --> 00:11.080
It allows us to work with strength in a different way.

00:11.470 --> 00:17.830
As you already know, in iOS five, we use single and double quotes and also in order to concatenate

00:17.830 --> 00:18.940
values, we had to use.

00:18.940 --> 00:25.030
Plus operator, let's recall once again how to deal with strings and gong to create variables.

00:25.750 --> 00:28.810
And let's use your known constant loud declarations.

00:29.320 --> 00:31.480
Creates variable name John.

00:32.820 --> 00:37.920
Then age, which equals to 28.

00:39.700 --> 00:42.040
Then create a third variable profession.

00:44.040 --> 00:45.390
Where the value instructor.

00:47.490 --> 00:53.160
Then create a function which actually will be a simple one, because I just want to remind you how to

00:53.490 --> 00:56.040
work with -- and how to concatenate values.

00:56.730 --> 00:59.180
At first I'm going to use S5 code.

00:59.220 --> 01:01.930
Therefore, let's call this function person.

01:01.950 --> 01:02.280
Yes.

01:04.150 --> 01:05.590
Then run in council.

01:06.980 --> 01:09.590
Some text, right, my name is.

01:11.950 --> 01:13.840
Then plus name.

01:15.980 --> 01:17.990
Plus, again, some text I am.

01:20.260 --> 01:22.090
That plays the variable age.

01:24.620 --> 01:28.250
That plus years old and I am.

01:30.550 --> 01:32.740
And finally, insert here.

01:33.790 --> 01:39.940
Variable profession, so here we use string values which are concatenated to variables, name, age

01:39.940 --> 01:40.650
and profession.

01:41.350 --> 01:43.480
For that we have used several plus size.

01:43.790 --> 01:50.140
Also, each part of string value is surrounded by quotes, but it's the way how we can work with string

01:50.140 --> 01:51.250
values in year five.

01:51.830 --> 01:53.680
OK, let's call this function right.

01:53.680 --> 01:54.820
Person E is five.

01:58.240 --> 01:59.630
So we have in council.

01:59.650 --> 02:07.390
My name is John, I'm 28 years old and I'm instructor, so we got the results, what we needed, but

02:07.390 --> 02:13.540
agreed that we have achieved it kind of hard way because, as we said, we have used several plus science

02:13.540 --> 02:18.340
quotes and so on in order to avoid such inconvenient way of working.

02:18.700 --> 02:21.510
Yes, this allows us to use tablet strength.

02:22.570 --> 02:24.010
Let's see what I'm talking about.

02:24.070 --> 02:27.040
Let's copy this function and paste here.

02:27.940 --> 02:29.830
Also, change the name from.

02:29.830 --> 02:31.600
Yes, five to six.

02:33.530 --> 02:39.920
I'm going to delete this content, which is placed in the log, and now it's time to use new temporary

02:39.930 --> 02:44.100
strengths which are expressed by tactics in most cases.

02:44.120 --> 02:47.830
This key is placed on the left side next to one key on keyboard.

02:48.650 --> 02:52.430
So the first that we want to write here is my name is.

02:54.230 --> 03:01.160
Then we need to place your name variable, but for that we do not need use plus size or adding single

03:01.160 --> 03:02.000
quotes anymore.

03:02.360 --> 03:05.260
Instead of that, we have to write dollar sign.

03:06.480 --> 03:15.880
That open cut the prices in place now variable then simply we have to make space here and right the

03:15.900 --> 03:18.180
next coming tax, which is an.

03:20.240 --> 03:28.360
As I see, we have to place here another variable, so let's do it and the same way use dollar sign,

03:29.150 --> 03:32.660
then curly braces and then age.

03:34.010 --> 03:47.120
Then again, right, text years old and I am and finally place here the variable profession in the same

03:47.120 --> 03:49.420
way with dollar sign and color prices.

03:50.690 --> 03:53.510
So as you see, we didn't use your plus sign.

03:53.690 --> 04:00.440
Also quotes, the entire thing is surrounded by batiks and the variables are placed in color prices

04:00.440 --> 04:02.160
and they are written with dollar signs.

04:03.200 --> 04:05.330
All right, let's invoke this function.

04:08.280 --> 04:15.580
Then reload and you see that we got an exact same result, but again, in more convenient and nice way.

04:16.330 --> 04:18.750
OK, you see here that we have words.

04:18.750 --> 04:19.380
I am.

04:19.380 --> 04:24.620
And suppose that we want to write it with apostrophe for that in is five.

04:24.630 --> 04:26.250
We had to use little Huck.

04:26.700 --> 04:30.330
We just need to use backslash and that single quote.

04:31.450 --> 04:37.140
Reload and see that it works, but in Essex, we can do it in much more simple way.

04:37.660 --> 04:42.850
We don't need any slashes because the string is surrounded by tactics which are absolutely different

04:42.850 --> 04:43.960
characters from codes.

04:44.620 --> 04:47.230
We just need to place your single quotes.

04:49.300 --> 04:52.290
Reload and we got the same result.

04:53.770 --> 04:54.250
All right.

04:55.290 --> 05:01.620
If we want to make line break in year five, we could do that using backslash and an.

05:04.220 --> 05:07.800
So reload and you see that line is broken in two parts.

05:08.330 --> 05:14.930
As for ethics, we can just break the line in code editor using pressing the enter key, which again

05:14.930 --> 05:17.180
is more convenient way to break lights.

05:19.130 --> 05:26.120
OK, so as I see tablet strength, a really great feature of ethics, it makes our lives much easier

05:26.120 --> 05:31.370
as a programmer, actually, I would like to note that if you don't need to concatenate string values

05:31.370 --> 05:35.170
with variables, then you can use a standard SFI way.

05:35.210 --> 05:38.420
I mean, you can declare variables with single or double quotes.

05:39.020 --> 05:42.590
So it's not mandatory to use tactics with variable declarations.

05:43.460 --> 05:43.910
All right.

05:44.210 --> 05:45.680
Let's use some more examples.

05:45.710 --> 05:51.470
I'm going to create a function which will actually calculate years of experience of person.

05:53.150 --> 06:00.290
Suppose that the person has working experience in two companies and we want to get the total sum of

06:00.290 --> 06:06.380
years of experience from both companies, so let's insert here two parameters, company one and.

06:07.510 --> 06:08.380
Company to.

06:11.440 --> 06:14.080
Then inside Kolob racist White Castle log.

06:16.420 --> 06:22.750
So in order to get the some of years of experience, we need to add the years of experience from company

06:22.960 --> 06:27.050
to company to and concatenate this value to string values.

06:27.670 --> 06:27.910
So.

06:27.910 --> 06:28.300
Right.

06:28.780 --> 06:29.470
I have.

06:30.970 --> 06:34.060
Then plus and open parenthesis.

06:35.110 --> 06:39.250
Insert here parameters company one and company to.

06:41.700 --> 06:42.510
Then plus.

06:44.070 --> 06:46.080
Years of experience.

06:49.410 --> 06:50.430
In programming.

06:54.110 --> 07:04.370
Let's invoke dysfunction and also use some arguments, right, for example, four and seven reload.

07:05.450 --> 07:06.510
And of course, it works.

07:07.010 --> 07:07.920
We got the results.

07:07.940 --> 07:10.910
I have 11 years of experience in programming.

07:12.170 --> 07:18.060
All right, let's transform it into ESX version instead of Cote's place here.

07:18.080 --> 07:18.740
Tactics.

07:20.280 --> 07:22.530
Then delete those plus signs.

07:27.250 --> 07:30.970
Surround Company one and company two with Calabrese and.

07:32.900 --> 07:35.390
Also place here, dollar sign.

07:37.740 --> 07:38.550
That's without.

07:39.800 --> 07:45.230
And you can see that we have, again, the same result as he saw at first, the addition was performed

07:45.230 --> 07:50.110
in coal prices and then we got string value, OK?

07:50.750 --> 07:54.470
Besides that, we were able to invoke the function inside collaborationists.

07:55.340 --> 07:59.600
Let's use here the value from person is six function for that.

07:59.600 --> 08:06.050
Let's change this cost of the log into return statement in order to get the value.

08:09.090 --> 08:11.070
Then place here.

08:12.380 --> 08:18.080
Experienced function, dollar sign and inside Calabrese invoke function.

08:19.280 --> 08:20.690
Person is six.

08:24.360 --> 08:26.850
Reload and we have results.

08:27.000 --> 08:31.500
My name is John, I'm 28 years old and I'm instructor.

08:31.800 --> 08:34.980
I have 11 years of experience in programming.

08:36.420 --> 08:37.220
OK, fine.

08:37.710 --> 08:38.860
It's really cool, right?

08:39.450 --> 08:45.630
So, again, templated strengths allow us to avoid using single quotes or double quotes and the relationship

08:45.630 --> 08:48.300
between them, which sometimes becomes really annoying.

08:48.810 --> 08:51.660
Also, we do not need to use classes anymore.

08:52.470 --> 08:52.950
All right.

08:53.340 --> 08:58.290
Before we finish this lecture, I'm going to introduce to you several built in three methods which were

08:58.740 --> 09:00.000
released in ethics.

09:00.420 --> 09:04.020
Those methods, in some cases may be used as powerful and great tools.

09:04.660 --> 09:08.040
The first method that I want to show you is start with method.

09:08.670 --> 09:16.330
So create a variable and call it grid, then assign to it string value.

09:17.340 --> 09:20.610
Hello, my dear students.

09:24.380 --> 09:30.670
Let's say we want to check if this thing value starts with specified character or characters, so for

09:30.680 --> 09:35.340
that we can use starts with matter, which actually returns boolean value, true or false.

09:35.960 --> 09:36.170
So.

09:36.170 --> 09:37.490
Right, Castlewood log.

09:38.620 --> 09:41.740
Grit that starts with.

09:42.800 --> 09:48.110
This matter takes as an argument, character or characters, which we want to check, as you see, our

09:48.110 --> 09:49.680
three value starts with hello.

09:49.700 --> 09:51.310
So let's use this word here.

09:51.320 --> 09:51.620
Right.

09:51.650 --> 09:52.070
Hello.

09:53.940 --> 09:57.020
Reload and we got through it.

09:57.090 --> 09:59.040
All right, hello without capital letter.

10:00.840 --> 10:05.040
Then we will get false because this matter takes into account the sensitivity.

10:06.230 --> 10:12.500
All right, in order to check if string value ends with specified character, we can use and with method

10:12.980 --> 10:16.880
that's duplicated, changed the name of the method.

10:16.890 --> 10:18.320
Right, and with.

10:21.050 --> 10:29.690
That revolt and we have false because this thing doesn't end with hello, let's change it into, for

10:29.690 --> 10:35.210
example, E.A., then you see that we've got through.

10:36.290 --> 10:36.790
All right.

10:37.760 --> 10:43.160
The next method that I want to show you is includes which actually checks if the string value includes

10:43.160 --> 10:49.340
the specified string characters that duplicate it again and change the method.

10:49.670 --> 10:50.090
Right.

10:50.090 --> 10:50.720
Includes.

10:52.280 --> 11:00.830
And as an argument, let's place here, dear, rule the page and you see that we have true because the

11:00.830 --> 11:03.240
work for you is a part of our strength value.

11:04.610 --> 11:11.240
OK, and the last method that I'm going to introduce you is repeat, as the name of this method tells

11:11.240 --> 11:13.830
us, it's obvious that it repeats the string values.

11:14.300 --> 11:23.540
So, for example, if we pass as an argument three, then we will get our string value three times.

11:24.350 --> 11:24.830
All right.

11:25.460 --> 11:28.190
Those methods are very helpful in the real world coding.

11:28.190 --> 11:33.410
So, you know already how they work and I'm sure that you will use them in your future projects.

11:34.270 --> 11:37.730
OK, it was all about strength in ethics.

11:38.310 --> 11:39.110
Let's go ahead.
