Class Convert
Static class containing methods for common conversions.
Inheritance
Inherited Members
Namespace: ERC.Utilities
Assembly: ERC.Net.dll
Syntax
public static class Convert
Methods
AsciiToBytes(String)
Converts an ASCII string to a byte array.
Declaration
public static byte[] AsciiToBytes(string ascii)
Parameters
Type | Name | Description |
---|---|---|
System.String | ascii | An ASCII string. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array containing the associated values. |
AsciiToHex(String)
Converts an ASCII string to a hex string
Declaration
public static string AsciiToHex(string ascii)
Parameters
Type | Name | Description |
---|---|---|
System.String | ascii | An ASCII string. |
Returns
Type | Description |
---|---|
System.String | A hex string. |
HexToAscii(String)
Converts a hex string to ASCII."
Declaration
public static string HexToAscii(string hex)
Parameters
Type | Name | Description |
---|---|---|
System.String | hex | A string containing hex characters. |
Returns
Type | Description |
---|---|
System.String | A string containing the equivalent ASCII values |
HexToBytes(String)
Converts a hex string to the equivalent bytes.
Declaration
public static byte[] HexToBytes(string hex)
Parameters
Type | Name | Description |
---|---|---|
System.String | hex | A string containing hex characters. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array containing the associated values. |
UnicodeToBytes(String)
Converts a Unicode string to a byte array.
Declaration
public static byte[] UnicodeToBytes(string unicode)
Parameters
Type | Name | Description |
---|---|---|
System.String | unicode | A Unicode string. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array. |
UnicodeToHex(String)
Converts a Unicode string to a hex string.
Declaration
public static string UnicodeToHex(string unicode)
Parameters
Type | Name | Description |
---|---|---|
System.String | unicode | A Unicode string. |
Returns
Type | Description |
---|---|
System.String | A hex string. |
UTF32ToBytes(String)
Converts a UTF-32 string to a byte array.
Declaration
public static byte[] UTF32ToBytes(string utf32)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf32 | A UTF-32 string. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array. |
UTF32ToHex(String)
Converts a UTF-32 string to a hex string.
Declaration
public static string UTF32ToHex(string utf32)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf32 | A UTF-32 string. |
Returns
Type | Description |
---|---|
System.String | A hex string. |
UTF7ToBytes(String)
Converts a UTF-7 string to a byte array.
Declaration
public static byte[] UTF7ToBytes(string utf7)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf7 | A UTF-7 string. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array. |
UTF7ToHex(String)
Converts a UTF-7 string to a hex string.
Declaration
public static string UTF7ToHex(string utf7)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf7 | A UTF-7 string. |
Returns
Type | Description |
---|---|
System.String | A hex string. |
UTF8ToBytes(String)
Converts a UTF-8 string to a byte array.
Declaration
public static byte[] UTF8ToBytes(string utf8)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf8 | A UTF-8 string. |
Returns
Type | Description |
---|---|
System.Byte[] | A byte array. |
UTF8ToHex(String)
Converts a UTF-8 string to a hex string.
Declaration
public static string UTF8ToHex(string utf8)
Parameters
Type | Name | Description |
---|---|---|
System.String | utf8 | A UTF-8 string. |
Returns
Type | Description |
---|---|
System.String | A hex string. |