Data Type - string
System.String
Returning the Length of a Constant
String.Copy("some text").Length
Hexadecimal Strings
Properties
| Chars | Gets the character at a specified character position in this instance. In C# this property is the indexer for the string class. |
| Length | Returns the length of the string. |
Methods
| Clone | Returns a reference to this instance of String. |
| Compare | Compares two strings. |
| CompareOrdinal | Compares two String objects, without considering the local national language or culture. |
| CompareTo | Compares this instance with a specified object. |
| Concat | Concatenates one or more instances of String, or the String representations of the values of one or more instances of Object. |
| Copy | Creates a new string by copying an existing string. |
| CopyTo | Copies a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters. |
| EndsWith | Determines whether the end of this instance matches the specified String |
| Equals | Determines if two strings are equal (i.e. have the same value). |
| Format | Formats a string to a particular specification |
| GetEnumerator | Retrieves an object that can iterate through the individual characters in this instance. |
| GetHashCode | Returns the hash code for this instance. |
| GetType | Gets the Type of the current instance. |
| GetTypeCode | Returns the TypeCode for class String. |
| IndexOf | Returns the index of the first occurrence of a character in a String. This is the equivalent for the VBA InStr() function |
| IndexOfAny | Returns the index of the first occurrence in any of the characters in an array. |
| Insert | Inserts a specified instance of String at a specified index position in this instance. |
| Intern | Retrieves the system's reference to the specified String. |
| IsInterned | |
| Join | Concatenates a specified separator String between each element of a specified String array, yielding a single concatenated string. |
| LastIndexOf | Returns the index of the last occurrence of a character in a String. |
| LastIndexOfAny | Returns the index of the last occurrence in any of the characters in an array. |
| PadLeft | Right aligns the characters in the string by padding the left with spaces. |
| PadRight | Left aligns the characters in the string by padding the right with spaces. |
| Remove | Deletes the specified number of characters. |
| Replace | Replaces all occurrences of a single character with another character or String. |
| Split | Returns an array. Divides a string, returning the substrings delimited by a specified character. |
| StartsWith | Indicates if a string starts with the specified characters. |
| Substring | Retrieves a substring from the string. |
| ToCharArray | Copies the characters from the string to a character array. |
| ToLower | Returns the text string with all characters converted to lowercase (String). |
| ToString | Converts the value of this instance to a String. |
| ToUpper | Returns the text string with all the characters converted to uppercase (String). |
| Trim | Returns the text string removing leading and trailing spaces (String). |
| TrimEnd | Returns the text string removing only trailing spaces (String). |
| TrimStart | Returns the text string removing only leading spaces (String). |
String.Empty
Use this instead of double quotes "".
String.IsNullOrEmpty
Instead of
if ((variable != null) && (variable != String.Empty))
{
}
use
if (String.IsNullOrEmpty(variable)
{
}
String.IsNullOrWhiteSpace
Added in .NET 4.0
Instead of
if (String.IsNullOrEmpty(variable.Trim()))
{
}
use
if (String.IsNullOrWhiteSpace(variable))
{
}
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext