1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
string
is a sequential collection of characters that is used to represent text. In C#, a string is an object of class string in the System namespace.
backslash (\)
is used to escape characters with special use, such as newline (\n)
'@' symbol
is used to ignore the special use of backslashes.
char
This property is used to get the character at a specified index position of a string.
Length
This property is used to get the total number of characters in the string.
bool Contains(string value)
This returns true if the specified substring occurs within the string object; otherwise, it returns false.
bool Equals(string value, StringComparison comparisonType)
This determines whether the specified substring has the same value with the string object
int IndexOf(char value)
This returns the index position value of the first occurrence of the specified character within the string object if that character is found; otherwise, it returns -1 if not found.
string Replace(char oldValue, char newValue)
This returns a copy of the string object except that all of the occurrences of an old character are replaced with a new character.
string ToString()
This returns a converted copy of object as a string.
string ToLower()
This returns a copy of the string object converted to lowercase.
string ToUpper()
This returns a copy of the string object converted to uppercase.
immutable
This means that when a string object is created, its contents cannot be changed.
StringBuilder class
represents a mutable string of characters that allows the user to expand the number of characters in the string object without allocating additional memory space.
Append
This appends a copy of the specified substring to the StringBuilder object.
Equals
This returns true if the specified substring is equal to the StringBuilder object; otherwise, it returns false
Clear()
This removes all characters from the current StringBuilder object.
Replace
This replaces all occurrence of a specified old character of the StringBuilder object with a new character.
ToString()
This converts the value of the StringBuilder object to a string.