type.
string | AddLine(this string str, string line) | Adds the specified line to the end of the current string. Returns the line if the current string is null. |
void | |
Appends a JavaScript- or JSON-compatible representation of the string with the appropriate characters escaped
into the specified StringBuilder. |
byte[] | |
Decodes this string from base-64-url encoding, which is safe for use in URLs and does not contain the
unnecessary padding when the number of bytes is not divisible by 3, into a byte array. |
string | |
Encodes this byte array to base-64-url format, which is safe for use in URLs and does not contain the
unnecessary padding when the number of bytes is not divisible by 3. |
string | |
Escapes all characters in this string whose code is less than 32 or form invalid UTF-16 using C/C#-compatible
backslash escapes. |
string | |
Reverses the escaping done by StringExtensions.CLiteralEscape(this string). Note that unescaping is not fully C/C#-compatible
in the sense that not all strings that are valid string literals in C/C# can be correctly unescaped by this
procedure. |
bool | |
Determines whether this string contains the other string using the ordinal case-insensitive comparison (StringComparison.OrdinalIgnoreCase). |
bool | | Use StringExtensions.ContainsIgnoreCase(this string, string). |
bool | |
Returns true if and only if this string ends with the specified character. |
bool | |
Determines whether the end of this string instance matches the specified string using the ordinal
case-insensitive comparison (StringComparison.OrdinalIgnoreCase). |
bool | |
Determines whether this string is equal to the other string using the ordinal case-insensitive comparison
(StringComparison.OrdinalIgnoreCase). |
bool | | Use StringExtensions.EqualsIgnoreCase(this string, string). |
string | |
Escapes all characters in this string which cannot form part of a valid filename on at least one supported
filesystem. The escaping is fully reversible (via StringExtensions.FilenameCharactersUnescape(this string)), but does not
treat characters at specific positions differently (e.g. the "." at the end of the name is not escaped, even
though it will disappear on a Win32 system). |
string | |
Reverses the transformation done by StringExtensions.FilenameCharactersEscape(this string, bool). This routine will also work on
filenames that cannot have been generated by the above escape procedure; any "invalid" escapes will be
preserved as-is. |
byte[] | | Reconstructs a byte array from its hexadecimal representation (“hexdump”). |
string | |
Converts the specified raw UTF-16 (little-endian) data to a string. |
string | |
Converts the specified raw UTF-16 (big-endian) data to a string. |
string | FromUtf8(this byte[] input, bool removeBom = false) |
Converts the specified raw UTF-8 data to a string. |
string | HtmlEscape(this string input, bool leaveSingleQuotesAlone = false, bool leaveDoubleQuotesAlone = false) |
Escapes all necessary characters in the specified string so as to make it usable safely in an HTML or XML
context. |
string | Indent(this string str, int by, bool indentFirstLine = true) |
Inserts spaces at the beginning of every line contained within the specified string. |
bool | | Determines whether the string contains only the characters 0-9. |
string | |
Returns a JavaScript- or JSON-compatible representation of the string with the appropriate characters escaped. |
string | |
Returns a JavaScript- or JSON-compatible representation of the string with the appropriate characters escaped.
Returns "null" if the input is null. |
string | |
Removes spaces from the beginning of every line in such a way that the smallest indentation is reduced to
zero. Lines which contain only whitespace are not considered in the calculation and may therefore become
empty. |
string | Repeat(this string input, int numTimes) |
Concatenates the specified number of repetitions of the current string. |
string | Replace(this string str, string oldValue, string newValue, StringComparison comparison) |
Returns a new string in which all occurrences of oldValue in the current instance,
identified using the specified string comparison, are replaced with newValue. |
IEnumerable<string> | Split(this string str, int chunkSize) |
Splits a string into chunks of equal size. The last chunk may be smaller than chunkSize,
but all chunks, if any, will contain at least 1 character. |
string[] | Split(this string str, params string[] separator) |
Returns a string array that contains the substrings in this string that are delimited by elements of a
specified string array. |
string[] | |
Returns a string array that contains the substrings in this string that are delimited by elements of a
specified string array. Empty items (zero-length strings) are filtered out. |
string | |
Returns an SQL-compatible representation of the string in single-quotes with the appropriate characters
escaped. |
bool | |
Returns true if and only if this string starts with the specified character. |
bool | |
Determines whether the beginning of this string instance matches the specified string using the ordinal
case-insensitive comparison (StringComparison.OrdinalIgnoreCase). |
string | |
Same as string.Substring(int) but counting from the right instead of left. Equivalent to
source.Reverse().Substring(startIndex).Reverse() . |
string | |
Same as string.Substring(int, int) but counting from the right instead of left. Equivalent to
source.Reverse().Substring(startIndex, length).Reverse() . |
string | |
Same as StringExtensions.SubstringSafe(this string, int) but counting from the right instead of left. Equivalent to
source.Reverse().SubstringSafe(startIndex).Reverse() . |
string | |
Same as StringExtensions.SubstringSafe(this string, int, int) but counting from the right instead of left. Equivalent
to source.Reverse().SubstringSafe(startIndex, length).Reverse() . |
string | |
Same as string.Substring(int) but does not throw exceptions when the start index falls outside
the boundaries of the string. Instead the result is truncated as appropriate. |
string | |
Same as string.Substring(int, int) but does not throw exceptions when the start index or length
(or both) fall outside the boundaries of the string. Instead the result is truncated as appropriate. |
byte[] | |
Converts the specified string to UTF-16. |
byte[] | |
Converts the specified string to UTF-16 (Big Endian). |
byte[] | |
Converts the specified string to UTF-8. |
IEnumerable<string> | Trim(this IEnumerable<string> values) | Returns the specified collection, but with leading and trailing empty strings and nulls removed. |
string | | Attempts to detect Unix-style and Mac-style line endings and converts them to Windows (\r\n). |
string | |
Removes the overall indentation of the specified string while maintaining the relative indentation of each
line. |
string | |
Escapes all necessary characters in the specified string so as to make it usable safely in a URL. |
bool | |
Determines whether the specified URL starts with the specified URL path. For example, the URL
"/directory/file" starts with "/directory" but not with "/dir". |
string | |
Reverses the escaping performed by StringExtensions.UrlEscape(this string) by decoding hexadecimal URL escape sequences into
their original characters. |
int | |
Determines the length of the UTF-16 encoding of the specified string. |
int | |
Determines the length of the UTF-8 encoding of the specified string. |
IEnumerable<string> | WordWrap(this string text, int maxWidth, int hangingIndent = 0) |
Word-wraps the current string to a specified width. Supports UNIX-style newlines and indented paragraphs. |