Class TypeExtensions
Type extensions used in this class library
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public static class TypeExtensions
Fields
| Edit this page View SourceWhiteSpaceChars
The Trim method only trims 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x0085, 0x2028, and 0x2029. This array adds in control characters.
Declaration
public static readonly char[] WhiteSpaceChars
Field Value
Type | Description |
---|---|
char[] |
Methods
| Edit this page View SourceHexStr(byte[], int, char?)
Converts a byte array to a hexadecimal formatted string
Declaration
public static string HexStr(this byte[] buffer, int length, char? separator = null)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | Input byte array to convert |
int | length | Number of bytes to process in the input array |
char? | separator | Separator character. May be null. |
Returns
Type | Description |
---|---|
string | Returns the formatted hexadecimal string |
HexStr(byte[], char?)
Converts a byte array to a hexadecimal formatted string
Declaration
public static string HexStr(this byte[] buffer, char? separator = null)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | Input byte array to convert |
char? | separator | Separator character. May be null. |
Returns
Type | Description |
---|---|
string | Returns the formatted hexadecimal string |
IsNullOrBlank(string)
Gets a value that indicates whether or not the collection is empty.
Declaration
public static bool IsNullOrBlank(this string s)
Parameters
Type | Name | Description |
---|---|---|
string | s |
Returns
Type | Description |
---|---|
bool |
IsPrivate(IPAddress)
Returns true if the IPAddress is a private address
Declaration
public static bool IsPrivate(this IPAddress address)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address |
Returns
Type | Description |
---|---|
bool |
NotNullOrBlank(string)
Returns true if the string is not null or blank
Declaration
public static bool NotNullOrBlank(this string s)
Parameters
Type | Name | Description |
---|---|---|
string | s | Input string |
Returns
Type | Description |
---|---|
bool |
ParseHexStr(string)
Parses an unformatted (no separators) hexadecimal string into a byte array
Declaration
public static byte[] ParseHexStr(string hexStr)
Parameters
Type | Name | Description |
---|---|---|
string | hexStr | Input hexadecimal string |
Returns
Type | Description |
---|---|
byte[] | Returns a byte array |
Slice(string, char, char)
Returns a slice from a string that is delimited by the first instance of a start and end character. The delimiting characters are not included.
"sip:127.0.0.1:5060;connid=1234".slice(':', ';') => "127.0.0.1:5060"
Declaration
public static string? Slice(this string s, char startDelimiter, char endDelimeter)
Parameters
Type | Name | Description |
---|---|---|
string | s | The input string to extract the slice from. |
char | startDelimiter | The character to start the slice from. The first instance of the character found is used. |
char | endDelimeter | The character to end the slice on. The first instance of the character found is used. |
Returns
Type | Description |
---|---|
string | A slice of the input string or null if the slice is not possible. |