⌘BABAKOV.NET Let's code!
100% [dark] [ru]
~/posts $

December 2016

1 total

1 total

Working with Strings in C#

The String class includes a number of methods for comparing, searching, and modifying string values. Here I will list the most frequently used (by me) capabilities of this class: Empty — a property that determines whether a string is empty; Compare() — compares two strings; CompareOrdinal() — allows comparing strings regardless of regional settings; Concat() — combines two or more strings into a new string; Copy() — copies the original string; Equals() — checks whether two strings have the same values; Format() — formats a string using a strictly defined format; Intern() — returns a reference to an existing string instance; Join() — adds a new string to a specified location in an existing string; Chars — a character index of the string; Length — the number of characters in the string; Clone() — returns a reference to an existing string; CompareTo() — compares one string with another; CopyTo() — copies a specified number of characters from the string to a Unicode character array; EndsWith() — checks whether a string ends with a specified sequence of characters; Equals() — determines whether two strings have the same values; Insert() — inserts a new string into an existing one; LastIndexOf() — returns the index of the last occurrence of an element in the string; PadLeft() — aligns a string to the right, skipping all spaces or other specially defined characters; PadRight() — aligns a string to the left, skipping all spaces or other specially defined characters; Remove() — removes a specified number of characters from the string; Split() — returns a substring separated from the main array by a specified character; StartsWith() — determines whether a string starts with a specified sequence of characters; Substring() — returns a substring from the main character array; ToCharArray() — copies characters from the string to a character array; ToLower() — converts characters in the string to lowercase; ToUpper() — converts characters in the string to uppercase; Trim() — removes all occurrences of specified characters from the beginning and end of the string; TrimEnd() — removes all occurrences of specified characters from the end of the string; TrimStart() — removes all occurrences of specified characters from the beginning of the string.<br><br>That's all the main stuff.

28 views 0 comments 0 likes ./Read →