A substring is any sequence of characters that is contained in a string.  We use Substring method when we want to create a new string that is based on original string. Replace method is used when we want to change parts of original string and create new one. IndexOf is used when we want to locate first occurrence of certain substring in string.


How to create new string using Multiple existing strings?

That process is called concatenation and all it basically does is append one string at the end of another string. In next example we will create 3 string and concatenate them. For this example Gangsta Lorem Ipsum is used.

As you can see new string is created using simple addition. Notice on third operation ” “, we have created a new string with only one blank space. Why? Because when we create new string we have to add it ourselves. Look at the end of first string, you can see that there is empty space at the end, so we did not have to add between firstString and secondString .


That’s all for now regarding string in future we will talk some more about them.

Tomorrow we will talk about reference types so be sure co check in again!