Class HexUtils
Utility class containing methods to work with hexadecimal values and several data type conversions.
Inheritance
Inherited Members
Namespace: XBeeLibrary.Core.Utils
Assembly: XBeeLibrary.Core.dll
Syntax
public class HexUtils
Methods
ByteArrayToHexString(Byte[])
Converts the given byte array into an hex string.
Declaration
public static string ByteArrayToHexString(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | Byte array to convert to hex string. |
Returns
Type | Description |
---|---|
System.String | Converted byte array to hex string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
See Also
ByteToHexString(Byte)
Converts the given byte into an hex string.
Declaration
public static string ByteToHexString(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | Byte to convert to hex string. |
Returns
Type | Description |
---|---|
System.String | Converted byte to hex string. |
ContainsLetters(String)
Checks whether the given parameter is a string or a numeric value.
Declaration
public static bool ContainsLetters(string parameter)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameter | Parameter to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if the given parameter is a string, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
HexStringToByteArray(String)
Converts the given hex string into a byte array.
Declaration
public static byte[] HexStringToByteArray(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Hex string to convert to byte array. |
Returns
Type | Description |
---|---|
System.Byte[] | Byte array of the given hex string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
See Also
IntegerToHexString(Int32, Int32)
Converts the given integer into an hexadecimal string.
Declaration
public static string IntegerToHexString(int value, int minBytes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The integer value to convert to hexadecimal string. |
System.Int32 | minBytes | The minimum number of bytes to be represented. |
Returns
Type | Description |
---|---|
System.String | The integer value as hexadecimal string. |
PrettyHexString(Byte[])
Converts the given byte array into an hex string and retrieves it in pretty format by splitting the content byte by byte.
Declaration
public static string PrettyHexString(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The byte array to convert to pretty hex string. |
Returns
Type | Description |
---|---|
System.String | The hexadecimal pretty string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
See Also
PrettyHexString(String)
Converts the given hexadecimal string to a pretty format by splitting the content byte by byte.
Declaration
public static string PrettyHexString(string hexString)
Parameters
Type | Name | Description |
---|---|---|
System.String | hexString | The hexadecimal string to convert. |
Returns
Type | Description |
---|---|
System.String | The hexadecimal string with pretty format. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |