codeGK
Code it ALL
C# Strings - CodeGK
♦ C# Strings

♣ About C# Strings

String is used to store the stream of characters.
Entities such as text, paragraphs are stored in strings.
Many interesting operations can be performed on strings, for instance, concatenation.

♣ Example1: Strings in C#

string keyword is used to define String in C#.
In this example, string data type is illustrated.
Example
Input:
Output:

♣ Example2: String Concatenation in C#

Concatenating is act of merging minimum two strings to form a third string.
In this example, Concatenation is illustrated with Concat() method and '+' symbol.
Example
Input:
Output:

♣ Example3: String Length in C#

Number of characters in a string variable is known as length of the string In this example, Length attribute is illustrated.
Example
Input:
Output:

♣ Example4: ToLower() in C#

ToLower() method converts all characters in string to lower case.
In this example, ToLower() is illustrated.
Example
Input:
Output:

♣ Example5: ToUpper() in C#

ToUpper() method converts all characters in string to upper case.
In this example, ToUpper() is illustrated.
Example
Input:
Output:

♣ Example6: Interpolation of Strings in C#

Interpolation in C# is an act of defining placeholders for the values then be used in string.
In this example, Two placeholders are illustrated holding value pre hand.
Example
Input:
Output:

♣ Example7: IndexOf() in C#

IndexOf() is a string method that finds the index of given character.
In this example, IndexOf() is illustrated.
Example
Input:
Output:

♣ Example8: Substring in C#

Substring() is a string method that accepts an integer as a parameter.
After accepting Integer as parameter a substring is returned.
Substring will have characters from the parameter-index up till the end.
In this example, Substring() is illustrated.
Example
Input:
Output:
Prev_LessonNext_Lesson