Class StringUtil
Provides utility methods for working with strings.
public static class StringUtil
- Inheritance
-
StringUtil
- Inherited Members
Methods
CheckChar(char, int, string)
Checks that the specified char fits within the specified bit mask.
public static void CheckChar(char c, int mask, string name)
Parameters
c
charThe specified char.
mask
intThe specified bit mask.
name
stringThe char name used in the exception message.
Exceptions
- ArgumentException
If the specified char does not fit within the mask.
EncodeChar(char)
Encodes the specified char to a string.
If the value of the char falls within the range of printable ASCII characters [32-126],
returns a string containing that character; otherwise, returns the Unicode escape sequence ("(\uxxxx)"
).
For a null char, returns "\0"
.
public static string EncodeChar(char c)
Parameters
c
charThe specified char.
Returns
- string
Returns the encoded string.
EncodeNullableString(string?)
Encodes the specified nullable string.
If the string is null, returns the string "null"
;
otherwise, returns the specified string.
public static string EncodeNullableString(string? s)
Parameters
s
stringThe specified string.
Returns
- string
The specified string or the string
"null"
.