All language subtitles for 9. Lets INTRODUCE stringh!

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Welcome back to our Recy programming course.

And in this video, what we are going to do is we are going to talk about the string that H library,

and although in these course we do not learn how to create our own libraries.

Yet it's important for us to understand, at least it's to some extent how to use already built in libraries

and how we can take different functionalities and use them inside of our program.

So this Thring library basically provides you with a lot of functionality that you can apply in strings.

And since there are a lot of functions that are being used on strings, most of them we can find out,

the most used ones we can find out in this library.

So simply take them and use them to whatever needs you need.

So some of the functionality that this library provides is finding the length of a given string.

OK.

We've already seen how to write the function that finds the length of a given string in in one of her

previous challenges.

And now what we want to do is to use this function that somebody else has written for us.

And it's stored inside of this library, inside of this string, that age.

And it's been called by SDR Orlan, meaning string length.

So you basically you just you don't have to develop this function on your own.

You can simply use it.

And these function basically will give you the length of a given string, just like we've done in previous

challenges.

The same goes here.

Just take it from the string that each library.

So I hope that's clear.

OK.

Also, another common function called the copying function, the copying content and these functions.

Simply what it does is taking one string and copying it into some other location, into some other string.

We also have functionality of the concatenating.

We can concatenate one string to the end of another string by using the SDR acat function.

And also we have a function to compare between strings using the SDR CMB function.

So these are the same.

Some of the main functions that we are going to talk about in this video and we will explain each of

them and understand how and when basically we can use them.

And the first one that we are going to talk about is the SDR land function.

So what these function does, this function is actually in charge of finding out the lengths of a given

string.

It's implemented in a similar way to the function we've written in one of our previous challenges.

It's gets it gets a string and returns its length.

Or better say it returns the number of characters until the first backslash, the euro or null character.

So for a given string, we will sum up all the characters until we reach the null character.

I hope that makes sense to you.

So if, for example, we will have a string, for example, it contains my name Vlad.

OK.

So the string can be represented in memory like an array of characters with characters V, L, a, d

and at the end of course we add the null character.

OK.

Because we use a string in our C language.

That's how the string actually resides in the memory of your computer.

If you open up your computer as a memory and take a look.

This is exactly how it's going to be stored.

And now if we apply the SDR land function on this string, the Lancs that is going to be returned from

this function is simply for which is the actual length of this string.

We didn't include the Baxley's zero because it's not actually a part of the name.

OK.

It's just ah, an addition that we using our string.

So that's how these function works.

You simply provide this function with a string and it returns to the length of the string until the

first now character.

Now let's take a look at a simple example with a couple of usages of this function.

And this code goes like this.

First of all, we will create a string, OK?

We will initialize a string.

And this range is called name.

And of course, that's how it's represented in memory.

And now once we have our string, what we are going to do is simply to print the length of the string.

Just by using this is the Erlend function.

So print f name, length percentage the end instead of these percentage, the we are going to call the

SDR land function.

And to give it as a parameter of the name and then the result, the expected the result of course is

going to be name length is just four characters.

So I hope that's clear.

And that's how you use this.

You're plan.

And now we are ready to move on to the next function.

And this function is asked the R c.p, why ista are a copy?

So we know that if we.

Want to copy one a rating to another?

We should basically use some loop and go over each of the elements of the source array and simply copy

them one by one to the target array.

And since we know that a string is considered to be an array of characters.

These copying operation is expected to be pretty much the same.

Right.

Simply to iterate over the source string and to copy element by element to the target string.

That's how you expect to do it.

But instead of making it so complicated, we can use the SDR recipe.

Why function?

That simply is responsible for copying the content of one string into another.

And this function basically has two parameters.

The first one is the destination string where we want to copy to.

And the second one is the source Thring, which is the source Thring that we want to copy in our case

is just it's just my name flood.

So now when you call the function of the source string, which is s the R one will basically be copied

into the destination string, which is in this case, just SDR two.

So that's how you use a copy string.

Very simple, guys.

Nothing complicated.

Let's see how it looks in code.

OK.

So now we are going to take a look at how we, first of all, initialize an array.

A string is the R one a D.

That's my name, Vlad.

And then we're also going to declare it just to create another string.

Guess the Rs2 in it will be of size 10.

OK.

It will be of size then.

And now what we are going to do is we are going to use the SDR, S.P. y function into copy, into my

name, into SDR too.

OK, so after these function is over inside of us, the Rs2 there is going to reside.

My name is also going to be there.

And now what we are going to do is just to make sure of it.

This function worked correctly.

So print Agfest the R one equals two percentages and SDR one.

That's how we print our strength on the screen.

You already know it by now.

And also we can use this.

The R two equals two percent just to print the SDR two to make sure that the copying operation worked.

OK, so the expected result we can see here is the R one equals two.

Vlad is the R two equals two, Vlad.

That's how we copied a string without using any loops, without using anything on complicating all of

this operation and making our code more clean.

And just by using one function, we copied all all this source string into the destination string.

So I hope that's clear.

So now if we want to summarize a little bit what s the R.S.V.P. y function does and how it works, we

can say that it's the RCP y simply gets as the first parameter of the address of the destination string

the place where we are going to copy to.

And does the second parameter of the RCMP y will get the address where resides the source string, the

string that we should copy, and a couple of nodes that you should bear in mind when using this function

is that it's your responsibility as the developer to make sure that there is enough memory in the destination

string to hold the source string.

So make sure you check it out before copying.

Otherwise, some problems are expected to be only detected at runtime and nothing in the compilation

phase because you see, the compiler will not warn you about these type of problems.

If you if the destination's thing does not have enough memory to hold the source Thring and it will

try to override some memory that does not belong to your program if that's the case.

So you don't want to let this happen.

So another note is that, first of all, is the enough memory.

And the second note is that the copy function is done only up to the first null character in the source

Thring.

So if the source Thring, I don't know, we zae, let's say 20 characters, but we have inside of this

Saura string.

We have two two instances of the null character, let's say null character ID index nine and null character

at Indexed 20, for example.

So this is the R.S.V.P. Y has the R.S.V.P. y function will only copy the string up until this first

null character.

So that's important that you will bear this in mind.

And last note about the SDR, S.P. y function is what these function returns.

And basically what it returns is the copied string.

So although SDR two will have will have the new string as the R.S.V.P. y by default it will return.

OK.

You may either accept its return, the result or not.

That's, that's up to you.

But it will return of the.

Rest of the new string where it resides.

So be aware of that and you may use it for your needs whenever you like.

All right.

So now let's talk about the next function in our string, the Ridge library.

And that's a political function called Ask the are cat or cat.

So what this function basically does is simply to concatenate one string to the end of the other.

So the first parameter of this function gets the destination string and the second parameter is the

source string.

And what we will do is simply to take the source string and to add it to the end of the destination

string.

Is that clear?

We will kind of joy in these two strings into one.

OK, we'll take the destination string and the source string, meaning SDR one, an SDR two, and simply

combine them at the SDR to the source.

Think to the end of the destination's three.

So we have one string.

Let's see some code examples.

So if once three years, let's say hello.

And the other is the other string is world.

So if we simply take and concatenate them, we use the SDR can't function the SDR card.

So the SDR destination is the first parameter.

The SDR source is the second parameter.

And then you simply concatenate them and afterwords you will get one string joined together with the

with the whole sentence of Hello World.

And this sentence is going to be stored inside of SDR, destination K of it will be appended to the

end of it.

So if we will use the print off-line.

So let's use print F string after a contact concatenation.

Is percentage asked.

And instead of these percentages, we are going to replace that with the SDR destination.

What we are going to see printed out on the screen, the result is going to be hello world.

So simply adding one string to the end of the other and creating one bigger and longer string.

And the notes here are pretty much the same as previously.

You simply concatenate the SDR source only up to the first are only up until you reach some first null

character.

Also, make sure that the SDR destination has enough memory to hold both strings after a concatenation.

So that's why here on the right you can see that we initialized and we declared, first of all, the

SDR destination of sice 20.

So it will be sufficient.

And so there will be sufficient memory.

There will be enough memory to hold also the hello world and the world mass.

The world, the war itself.

OK.

So there will be enough memory to hold both of these strings in the SDR, this Diggnation.

And just to demonstrate this concatenation process once again.

So SDR destination, first of all, has the word hello.

OK.

Hello.

H e l l o and a space after words.

And of course there is a backslash zero with the end of it.

And during the concatenation, this function, this SDR acat, what it does is simply overwrite this

backslash zero at the end is null character with the end of the hello world.

And wards it takes the world and it places it right after the hello.

And it adds are only the backslash zero to the end of the concatenate string.

So it creates a new string with a backslash zero at the end of it, just as we expect.

And now to the last function that we are going to talk about in this video.

And this function is called SDR, CMB.

All these function does is just the lexical graphical comparison.

It's just compares between two strings.

And if you guys are not familiar with this term, simply think about it like you.

You're looking for two words in a dictionary.

So in every dictionary, the words appearing some organized manner.

Right.

First you have over the words, starting with the letter A, then B and so.

They are organized in some structure.

So lexicographical comparison simply means that if you take two words, two strings in our case and

look for them in the dictionary, you would like to know which one of them would come first and which

one of them would come the second.

So with the first string, we have two strings, right?

If the first thing is going to be placed before the second string.

If we take a look at this dictionary and we see that the first string comes before the second.

OK, so let's say it has a B.A..

The first thing and the second string is a B, so ABH is definitely the first string and it will come

before the second one.

So if that's the case, this function.

This is the RCMP will simply return minus one.

And if.

Opposite than the function, if its opposite, meaning that the first ring was a beeby and the second

string was a, B, a..

OK.

So in this case, the three and the function is going to return plus one.

And if both of the rings are identical.

So the yes.

The RCMP will return zero.

So I know it may be confusing a little bit at this time.

So let's take another look at another example.

And let's say if we have two strings and the first one is my.

And the second one is Mike.

OK, and we use the s the RCMP on both of these strings.

So the first parameter is string one.

The second one is string two.

So this function for this combination of strings will return minus one.

So we know that the string one is kind of less than string two, it will appear before in the lexicographical

manner.

But if we would specify the string to as the first parameter and string to one as the second a parameter,

until I tell you the argument, then the function is going to return plus one.

And if both of them.

Of if both of the strings were, let's say, Michael K String doing string to both of the strings were

Mike.

We if we want to see if one string equals to another string.

So this function in this case will return just zero.

So I hope that's clear, guys, because all these function does is simply to compare between two strings

and to let you know are some rules about which string is kind of bigger and which string is kind of

smaller in which one will appear before the other.

In some dictionary and basically in most of the times, what's most interesting here is the results

of the S2.

RCMP will return zero because if it returns zero, then we know that both strings are the same.

Otherwise, we know they are not the same.

So most of the time, that's why when you would like to use this function.

So I guess this is it for this video, guys.

Thank you so much for watching.

That was not an easy not an easy video, not an easy lesson.

We learned a couple of functions that are being used that we can use in from the string that H library.

And actually there are a lot of additional functions that you can find out by yourself or ask me probably

to make some summary for you that you will be much more easier to you, but also try to trade on your

own.

That's that's also important.

So, as always, thank you so much for watching.

And I'll see you in the next video.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.