Fixed-size UTF32 string. All operations are alloc-free, except for converting to System.String. More...
Inherits INetworkString, INetworkStruct, IEquatable< NetworkString< TSize >>, and IEnumerable< char >.
Public Member Functions | |
void | Assign (string value) |
Assign a new value to this NetworkString. More... | |
int | Compare (NetworkString< TSize > s) |
Compares this instance with a specified NetworkString. More... | |
int | Compare (ref NetworkString< TSize > s) |
Compares this instance with a specified NetworkString. More... | |
int | Compare (string s) |
Compares this instance with a specified string. More... | |
int | Compare< TOtherSize > (NetworkString< TOtherSize > other) |
Compares this instance with a specified NetworkString of a different size. More... | |
int | Compare< TOtherSize > (ref NetworkString< TOtherSize > other) |
Compares this instance with a specified NetworkString of a different size. More... | |
bool | Contains (char c) |
Determines whether a specified character is in this instance. More... | |
bool | Contains (string str) |
Determines whether a specified string is in this instance. More... | |
bool | Contains (uint codePoint) |
Determines whether a specified Unicode code point is in this instance. More... | |
bool | Contains< TOtherSize > (NetworkString< TOtherSize > str) |
Determines whether a specified NetworkString is in this instance. More... | |
bool | Contains< TOtherSize > (ref NetworkString< TOtherSize > str) |
Determines whether a specified NetworkString is in this instance. More... | |
bool | EndsWith (string s) |
Checks if the current NetworkString ends with a specified string. More... | |
bool | EndsWith< TOtherSize > (ref NetworkString< TOtherSize > other) |
Checks if the current NetworkString ends with a specified NetworkString of a different size. More... | |
bool | Equals (NetworkString< TSize > other) |
Determines whether the current NetworkString is equal to a specified NetworkString. More... | |
override bool | Equals (object obj) |
Determines whether the current NetworkString is equal to a specified object. More... | |
bool | Equals (ref NetworkString< TSize > other) |
Determines whether the current NetworkString is equal to a specified NetworkString. More... | |
bool | Equals (string s) |
Determines whether the current NetworkString is equal to a specified string. More... | |
bool | Equals< TOtherSize > (NetworkString< TOtherSize > other) |
Determines whether the current NetworkString is equal to a specified NetworkString of a different size. More... | |
bool | Equals< TOtherSize > (ref NetworkString< TOtherSize > other) |
Determines whether the current NetworkString is equal to a specified NetworkString of a different size. More... | |
bool | Get (ref string cache) |
Checks if cache is equivalent and if not converts to UTF16 and stores the result in cache . More... | |
int | GetCharCount () |
Calculates the length of the equivalent UTF16 string. More... | |
UTF32Tools.CharEnumerator | GetEnumerator () |
Returns an enumerator that iterates through the NetworkString. More... | |
IEnumerator< char > IEnumerable< char >. | GetEnumerator () |
IEnumerator IEnumerable. | GetEnumerator () |
override int | GetHashCode () |
Returns the hash code for this NetworkString. More... | |
int | IndexOf (char c, int startIndex, int count) |
Returns the index of the first occurrence of a specified character in this instance. More... | |
int | IndexOf (char c, int startIndex=0) |
Returns the index of the first occurrence of a specified character in this instance. More... | |
int | IndexOf (string str, int startIndex, int count) |
Returns the index of the first occurrence of a specified string in this instance. More... | |
int | IndexOf (string str, int startIndex=0) |
Returns the index of the first occurrence of a specified string in this instance. More... | |
int | IndexOf (uint codePoint, int startIndex, int count) |
Returns the index of the first occurrence of a specified Unicode code point in this instance. More... | |
int | IndexOf (uint codePoint, int startIndex=0) |
Returns the index of the first occurrence of a specified Unicode code point in this instance. More... | |
int | IndexOf< TOtherSize > (NetworkString< TOtherSize > str, int startIndex, int count) |
Returns the index of the first occurrence of a specified NetworkString in this instance. More... | |
int | IndexOf< TOtherSize > (NetworkString< TOtherSize > str, int startIndex=0) |
Returns the index of the first occurrence of a specified NetworkString in this instance. More... | |
int | IndexOf< TOtherSize > (ref NetworkString< TOtherSize > str, int startIndex, int count) |
Returns the index of the first occurrence of a specified NetworkString in this instance. More... | |
int | IndexOf< TOtherSize > (ref NetworkString< TOtherSize > str, int startIndex=0) |
Returns the index of the first occurrence of a specified NetworkString in this instance. More... | |
NetworkString (string value) | |
Creates a new instance of NetworkString<Size> with the given value. More... | |
bool | Set (string value) |
Converts value to UTF32 string and stores it internally. More... | |
bool | StartsWith (string s) |
Checks if the current NetworkString starts with a specified string. More... | |
bool | StartsWith< TOtherSize > (ref NetworkString< TOtherSize > other) |
Checks if the current NetworkString starts with a specified NetworkString of a different size. More... | |
NetworkString< TSize > | Substring (int startIndex) |
Returns a substring from this instance. The substring starts at a specified character position. More... | |
NetworkString< TSize > | Substring (int startIndex, int length) |
Returns a substring from this instance. The substring starts at a specified character position and has a specified length. More... | |
NetworkString< TSize > | ToLower () |
Converts all the characters in this NetworkString to lowercase. More... | |
override string | ToString () |
Converts the value of this NetworkString to its equivalent string representation. More... | |
NetworkString< TSize > | ToUpper () |
Converts all the characters in this NetworkString to uppercase. More... | |
Static Public Member Functions | |
static int | GetCapacity< TSize > () |
Gets the capacity of a NetworkString of a specified size. More... | |
static implicit | operator NetworkString< TSize > (string str) |
Defines an implicit conversion of a string to a NetworkString. More... | |
static | operator string (NetworkString< TSize > str) |
Defines an explicit conversion of a NetworkString to a string. More... | |
static bool | operator!= (NetworkString< TSize > a, NetworkString< TSize > b) |
Defines an inequality operator for NetworkString. More... | |
static bool | operator!= (NetworkString< TSize > a, string b) |
Defines an inequality operator for a NetworkString and a string. More... | |
static bool | operator!= (string a, NetworkString< TSize > b) |
Defines an inequality operator for a string and a NetworkString. More... | |
static bool | operator== (NetworkString< TSize > a, NetworkString< TSize > b) |
Defines an equality operator for NetworkString. More... | |
static bool | operator== (NetworkString< TSize > a, string b) |
Defines an equality operator for a NetworkString and a string. More... | |
static bool | operator== (string a, NetworkString< TSize > b) |
Defines an equality operator for a string and a NetworkString. More... | |
Properties | |
int | Capacity [get] |
Maximum UTF32 string length. More... | |
int | Length [get] |
Number of UTF32 scalars. It is equal or less than GetCharCount or the length of Value, because those use UTF16 encoding, which needs two characters to encode some values. More... | |
ref uint | this[int index] [get] |
Returns UTF32 scalar at index position. To iterate over characters, use GetEnumerator. More... | |
string | Value [get, set] |
Converts to/from regular UTF16 string. Setter is alloc-free. Use Get to get possibly alloc-free conversion. More... | |
Fixed-size UTF32 string. All operations are alloc-free, except for converting to System.String.
Provides static methods for NetworkString operations.
TSize |
TSize | : | unmanaged | |
TSize | : | IFixedStorage |
NetworkString | ( | string | value | ) |
Creates a new instance of NetworkString<Size> with the given value.
value | String value. |
void Assign | ( | string | value | ) |
Assign a new value to this NetworkString.
value | String value. |
int Compare | ( | NetworkString< TSize > | s | ) |
Compares this instance with a specified NetworkString.
s | The NetworkString to compare. |
int Compare | ( | ref NetworkString< TSize > | s | ) |
Compares this instance with a specified NetworkString.
s | The NetworkString to compare. |
int Compare | ( | string | s | ) |
Compares this instance with a specified string.
s | The string to compare. |
int Compare< TOtherSize > | ( | NetworkString< TOtherSize > | other | ) |
Compares this instance with a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to compare. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | Compare | |
TOtherSize | : | ref | |
TOtherSize | : | other |
int Compare< TOtherSize > | ( | ref NetworkString< TOtherSize > | other | ) |
Compares this instance with a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to compare. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage |
bool Contains | ( | char | c | ) |
Determines whether a specified character is in this instance.
c | The Unicode character to seek. |
bool Contains | ( | string | str | ) |
Determines whether a specified string is in this instance.
str | The string to seek. |
bool Contains | ( | uint | codePoint | ) |
Determines whether a specified Unicode code point is in this instance.
codePoint | The Unicode code point to seek. |
bool Contains< TOtherSize > | ( | NetworkString< TOtherSize > | str | ) |
Determines whether a specified NetworkString is in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | IndexOf | |
TOtherSize | : | ref | |
TOtherSize | : | str |
bool Contains< TOtherSize > | ( | ref NetworkString< TOtherSize > | str | ) |
Determines whether a specified NetworkString is in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | IndexOf | |
TOtherSize | : | ref | |
TOtherSize | : | str |
bool EndsWith | ( | string | s | ) |
Checks if the current NetworkString ends with a specified string.
s | The string to check. |
ArgumentNullException | Thrown when the string is null. |
bool EndsWith< TOtherSize > | ( | ref NetworkString< TOtherSize > | other | ) |
Checks if the current NetworkString ends with a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to check. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage |
bool Equals | ( | NetworkString< TSize > | other | ) |
Determines whether the current NetworkString is equal to a specified NetworkString.
other | The NetworkString to compare with the current NetworkString. |
override bool Equals | ( | object | obj | ) |
Determines whether the current NetworkString is equal to a specified object.
obj | The object to compare with the current NetworkString. |
bool Equals | ( | ref NetworkString< TSize > | other | ) |
Determines whether the current NetworkString is equal to a specified NetworkString.
other | The NetworkString to compare with the current NetworkString. |
bool Equals | ( | string | s | ) |
Determines whether the current NetworkString is equal to a specified string.
s | The string to compare with the current NetworkString. |
bool Equals< TOtherSize > | ( | NetworkString< TOtherSize > | other | ) |
Determines whether the current NetworkString is equal to a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to compare with the current NetworkString. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | Compare | |
TOtherSize | : | ref | |
TOtherSize | : | other |
bool Equals< TOtherSize > | ( | ref NetworkString< TOtherSize > | other | ) |
Determines whether the current NetworkString is equal to a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to compare with the current NetworkString. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | Compare | |
TOtherSize | : | ref | |
TOtherSize | : | other |
bool Get | ( | ref string | cache | ) |
Checks if cache is equivalent and if not converts to UTF16 and stores the result in cache .
cache | The string to convert. |
|
static |
Gets the capacity of a NetworkString of a specified size.
TSize | The size of the NetworkString. |
TSize | : | unmanaged | |
TSize | : | IFixedStorage |
int GetCharCount | ( | ) |
Calculates the length of the equivalent UTF16 string.
UTF32Tools.CharEnumerator GetEnumerator | ( | ) |
Returns an enumerator that iterates through the NetworkString.
override int GetHashCode | ( | ) |
Returns the hash code for this NetworkString.
int IndexOf | ( | char | c, |
int | startIndex, | ||
int | count | ||
) |
Returns the index of the first occurrence of a specified character in this instance.
c | The Unicode character to seek. |
startIndex | The search starting position. |
count | The number of character positions to examine. |
int IndexOf | ( | char | c, |
int | startIndex = 0 |
||
) |
Returns the index of the first occurrence of a specified character in this instance.
c | The Unicode character to seek. |
startIndex | The search starting position. |
int IndexOf | ( | string | str, |
int | startIndex, | ||
int | count | ||
) |
Returns the index of the first occurrence of a specified string in this instance.
str | The string to seek. |
startIndex | The search starting position. |
count | The number of character positions to examine. |
ArgumentNullException | Thrown when the string is null. |
ArgumentOutOfRangeException | Thrown when the start index is less than zero or greater than the safe length of the string, or when the count is less than zero or the sum of the start index and count is greater than the safe length of the string. |
int IndexOf | ( | string | str, |
int | startIndex = 0 |
||
) |
Returns the index of the first occurrence of a specified string in this instance.
str | The string to seek. |
startIndex | The search starting position. |
int IndexOf | ( | uint | codePoint, |
int | startIndex, | ||
int | count | ||
) |
Returns the index of the first occurrence of a specified Unicode code point in this instance.
codePoint | The Unicode code point to seek. |
startIndex | The search starting position. |
count | The number of character positions to examine. |
ArgumentOutOfRangeException | Thrown when the start index is less than zero or greater than the safe length of the string, or when the count is less than zero or the sum of the start index and count is greater than the safe length of the string. |
int IndexOf | ( | uint | codePoint, |
int | startIndex = 0 |
||
) |
Returns the index of the first occurrence of a specified Unicode code point in this instance.
codePoint | The Unicode code point to seek. |
startIndex | The search starting position. |
int IndexOf< TOtherSize > | ( | NetworkString< TOtherSize > | str, |
int | startIndex, | ||
int | count | ||
) |
Returns the index of the first occurrence of a specified NetworkString in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
startIndex | The search starting position. |
count | The number of character positions to examine. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | IndexOf | |
TOtherSize | : | ref | |
TOtherSize | : | str | |
TOtherSize | : | startIndex | |
TOtherSize | : | count |
int IndexOf< TOtherSize > | ( | NetworkString< TOtherSize > | str, |
int | startIndex = 0 |
||
) |
Returns the index of the first occurrence of a specified NetworkString in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
startIndex | The search starting position. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | IndexOf | |
TOtherSize | : | ref | |
TOtherSize | : | str | |
TOtherSize | : | startIndex | |
TOtherSize | : | SafeLength | |
TOtherSize | : | startIndex |
int IndexOf< TOtherSize > | ( | ref NetworkString< TOtherSize > | str, |
int | startIndex, | ||
int | count | ||
) |
Returns the index of the first occurrence of a specified NetworkString in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
startIndex | The search starting position. |
count | The number of character positions to examine. |
ArgumentOutOfRangeException | Thrown when the start index is less than zero or greater than the safe length of the string, or when the count is less than zero or the sum of the start index and count is greater than the safe length of the string. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage |
int IndexOf< TOtherSize > | ( | ref NetworkString< TOtherSize > | str, |
int | startIndex = 0 |
||
) |
Returns the index of the first occurrence of a specified NetworkString in this instance.
TOtherSize | The size of the other NetworkString. |
str | The NetworkString to seek. |
startIndex | The search starting position. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage | |
TOtherSize | : | IndexOf | |
TOtherSize | : | ref | |
TOtherSize | : | str | |
TOtherSize | : | startIndex | |
TOtherSize | : | SafeLength | |
TOtherSize | : | startIndex |
|
static |
Defines an implicit conversion of a string to a NetworkString.
str | The string to convert. |
|
explicitstatic |
Defines an explicit conversion of a NetworkString to a string.
str | The NetworkString to convert. |
|
static |
Defines an inequality operator for NetworkString.
a | The first NetworkString to compare. |
b | The second NetworkString to compare. |
|
static |
Defines an inequality operator for a NetworkString and a string.
a | The NetworkString to compare. |
b | The string to compare. |
|
static |
Defines an inequality operator for a string and a NetworkString.
a | The string to compare. |
b | The NetworkString to compare. |
|
static |
Defines an equality operator for NetworkString.
a | The first NetworkString to compare. |
b | The second NetworkString to compare. |
|
static |
Defines an equality operator for a NetworkString and a string.
a | The NetworkString to compare. |
b | The string to compare. |
|
static |
Defines an equality operator for a string and a NetworkString.
a | The string to compare. |
b | The NetworkString to compare. |
bool Set | ( | string | value | ) |
Converts value to UTF32 string and stores it internally.
value | The string to set. |
bool StartsWith | ( | string | s | ) |
Checks if the current NetworkString starts with a specified string.
s | The string to check. |
ArgumentNullException | Thrown when the string is null. |
bool StartsWith< TOtherSize > | ( | ref NetworkString< TOtherSize > | other | ) |
Checks if the current NetworkString starts with a specified NetworkString of a different size.
TOtherSize | The size of the other NetworkString. |
other | The NetworkString to check. |
TOtherSize | : | unmanaged | |
TOtherSize | : | IFixedStorage |
NetworkString<TSize> Substring | ( | int | startIndex | ) |
Returns a substring from this instance. The substring starts at a specified character position.
startIndex | The zero-based starting character position of a substring in this instance. |
ArgumentOutOfRangeException | startIndex is less than zero or greater than the length of this instance. |
NetworkString<TSize> Substring | ( | int | startIndex, |
int | length | ||
) |
Returns a substring from this instance. The substring starts at a specified character position and has a specified length.
startIndex | The zero-based starting character position of a substring in this instance. |
length | The number of characters in the substring. |
ArgumentOutOfRangeException | startIndex plus length indicates a position not within this instance, or startIndex or length is less than zero. |
NetworkString<TSize> ToLower | ( | ) |
Converts all the characters in this NetworkString to lowercase.
override string ToString | ( | ) |
Converts the value of this NetworkString to its equivalent string representation.
NetworkString<TSize> ToUpper | ( | ) |
Converts all the characters in this NetworkString to uppercase.
|
get |
Maximum UTF32 string length.
|
get |
Number of UTF32 scalars. It is equal or less than GetCharCount or the length of Value, because those use UTF16 encoding, which needs two characters to encode some values.
|
get |
Returns UTF32 scalar at index position. To iterate over characters, use GetEnumerator.
index | Index to get. |
|
getset |
Converts to/from regular UTF16 string. Setter is alloc-free. Use Get to get possibly alloc-free conversion.