‫All right.
‫Now let's look at the other exercise.
‫So string challenge number two.
‫And the first thing we needed to do is to ask the user to enter a string.
‫And he would enter the string here and we store that string as input and we'll do that in the main method.
‫As always, this will allow us to get a user input and that will be inside of our input and then we
‫get another user input.
‫And what we want to have is we want to know the character that the person is searching for.
‫So enter a character to search and then the person should enter one character.
‫And you can see we're using char here, we're not using string, but we only want to have one character
‫and we create a new variable here called search input, which will be a char, so a character.
‫And then we get the red line and we only take the very first entry.
‫So we say, get me the very first character in that console, red line, because this red line is going
‫to return a string.
‫And by using the square brackets and the index that you want to have, you can get a specific position
‫of that string.
‫And in this case we get the very first character of that string.
‫Next, we need to get the index of the character from the string.
‫So let's create a new integer variable which will take care of that and it will get the.
‫Input index of search input and it will store that in search index.
‫So what is input?
‫Well, input is this variable here, which is our console red line.
‫So whatever the user entered and then we get the index of a specific character.
‫So if you look at index of there are multiple overloads, but one of them is that it will need a char.
‫So a character, if you hover over it, you can see that and you can see it returns an int.
‫So that's exactly what we have here.
‫We have an int here which is called search index.
‫So we take the input and we get the index of a specific character.
‫So we just say, okay, which position is this character for the first time within input.
‫So within the string that we are currently looking at and then we just want to print that out.
‫So let's do that.
‫Let's print the index as a search result on the console.
‫And we do that by saying index of character.
‫And here we say zero, which means this variable here in string is one, which is this search index.
‫Okay, so let's just run this and see what the result will be.
‫So here I'm going to enter tutorials dot EU and now I'm going to search for a dot and you can see index
‫of character dot in string is nine.
‫So we have
‫0123456789.
‫So that's going to be the index of my character.
‫Dot As you know, it starts with zero.
‫So this tutorials is going to be modest, is going to be zero.
‫Okay.
‫So that was the first part of the exercise.
‫Now let's get to the second one where we use concatenation.
‫And in order to use concatenation, we need two strings that we want to combine with each other.
‫And what I'm going to do is I'm going to get two strings from the user.
‫So first of all, I want to get the first name of the user, then I want to get the last name of the
‫user.
‫And then what I'm going to do is I'm going to concatenate them, which means I'm going to combine them
‫to be one string.
‫So let's do that.
‫Let's concatenate them.
‫By using the following code so you can see we are.
‫We are concatenating by using the conquest method.
‫And what it will do is it will concatenate multiple strings with each other, even in this case.
‫So it's going to take first name, whatever the user has entered.
‫So here we ask for the first name, then we ask for the last name.
‫But what we also add is an empty space in between because we don't want to have the names.
‫Directly after another.
‫But we want to have an empty space in between.
‫And then we just print out the full name.
‫And you can see it's a new variable called full name.
‫Of course, we could have used the concatenation directly here, or we could have just said Position
‫one, position two.
‫So there are many different options, but I wanted to you to specifically use this concrete method to
‫do concatenation.
‫Okay.
‫So now let's run this again.
‫And well we had the string example I told you then the index I'm going to use zero and then here enter
‫the first name.
‫So it's going to be Dennis last name, punch button and you can see your full name is Dennis Panopto.
‫Well, in my case, that's the case for you.
‫It's going to be a different name.
‫All right.
‫So that is it.
‫I hope you were successful writing this code.
‫And if you have another solution for this, that's fine as well.
‫But now you know how to specifically use concatenation with the concrete method.
‫And by the way, you can also see that concatenation will return a string.
‫So when you hover over it, it even tells you what it's going to return.
‫So in our case, it's going to return string zero, string one and string to concatenate it, which
‫just means connect it together to one string.
‫All right.
‫So that's it for this video.
‫I hope you were successful with this.
‫See you in the next one.