String_Quiz.md - brainchildservices/curriculum GitHub Wiki
-
What is C# String?
- In C#, a string is a series of characters that is used to represent text. It can be a character, a word or a long passage surrounded with the double quotes ". C# provides the String data type to store string literals. 2.### Guess which one is right?
- string s='anand';
- string s="anand";
- string s=anand;
- Answer: string s="anand";
-
What is String Length?
- Returns the number of characters in a string
-
String s="i am";
int m=s.length;
- 4
- 2
- 3
- 0
- _Ans:1
-
What do you mean by String Concatenation?
- The + operator can be used between strings to combine them. This is called concatenation.
-
What is String Interpolation?
- Another option of string concatenation, is string interpolation, which substitutes values of variables into placeholders in a string.
-
What is String.Format?
- String.Format() method formats strings in a desired format by inserting objects and variables with specified space and alignments into another strings and literals. It is also often used to format strings into specific formats.
-
How to access each character of a string?
- You can access the characters in a string by referring to its index number inside square brackets [].
-
What are escape characters?
- An escape sequence in C language is a sequence of characters that doesn't represent itself when used inside string literal or character.
-
Examples for escape characters
\b - Backspace \f - Form Feed \n - New Line \r - Carriage Return