Manipulating Strings
The String class provides a host of methods for comparing, searching, and manipulating strings, the most important of which are shown in Table 15-1.
Table 15-1. String class properties and methods
Method or property | Explanation |
|---|---|
| Property that returns the string indexer |
| Overloaded public static method that compares two strings |
| Public static method that creates a new string by copying another |
| Overloaded public static and instance methods that determine whether two strings have the same value |
| Overloaded public static method that formats a string using a format specification |
| Property that returns the number of characters in the instance |
| Right-aligns the characters in the string, padding to the left with spaces or a specified character |
| Left-aligns the characters in the string, padding to the right with spaces or a specified character |
| Deletes the specified number of characters |
| Divides a string, returning the substrings delimited by the specified characters |
| Indicates whether the string starts with the specified characters |
| Retrieves a substring |
| Copies the characters from the string to a character array |
| Returns a copy of the string in lowercase |
| Returns a copy of the string in uppercase |
| Removes all occurrences of a set of specified characters from the beginning and end of the string |
| Behaves like |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access