SpringCard LibCs for .NET  18.10.10
A set of utilities to simplify the development of .NET application
SpringCard.LibCs.BinConvert Class Reference

Utilities to convert text into numbers or array, and reverse. More...

Static Public Member Functions

static byte [] StringToByteArray (string str, bool includeEndZero=false)
 Convert a string into an array of bytes. More...
 
static string ByteArrayToString (byte[] val, bool stopOnZero=true, bool hideNonAscii=false)
 Convert an array of bytes into a string. More...
 
static string ByteArrayToString (byte[] val, int offset, int length=-1, bool stopOnZero=true, bool hideNonAscii=false)
 Convert an array of bytes into a string.
 
static string ByteArrayToStringAscii (byte[] value)
 
static int DecToInt (string dec)
 Convert an decimal representation of an integer into its actual value.
 
static int ParseInt (string dec)
 Convert an decimal representation of an integer into its actual value. More...
 
static uint DecToUInt (string dec)
 Convert an decimal representation of an unsigned integer into its actual value.
 
static uint ParseUInt (string dec)
 Convert an decimal representation of an unsigned integer into its actual value. More...
 
static UInt32 ParseDW (string dec)
 
static byte [] HexToBytes (string hex)
 Convert an hexadecimal representation of an array of bytes into its actual value.
 
static byte [] ParseHex (string hex)
 Convert an hexadecimal representation of an array of bytes into its actual value. More...
 
static byte HexToByte (string hex)
 Convert an hexadecimal representation of one byte into its actual value.
 
static byte ParseHexB (string hex)
 Convert an hexadecimal representation of one byte into its actual value. More...
 
static UInt16 HexToWord (string hex)
 Convert an hexadecimal representation of two bytes into their actual value.
 
static UInt16 ParseHexW (string hex)
 Convert an hexadecimal representation of two bytes into their actual value. More...
 
static UInt32 HexToDword (string hex)
 Convert an hexadecimal representation of four bytes into their actual value.
 
static UInt32 ParseHexDW (string hex)
 Convert an hexadecimal representation of four bytes into their actual value. More...
 
static UInt64 HexToQword (string hex)
 Convert an hexadecimal representation of eight bytes into the actual value.
 
static UInt64 ParseHexUInt64 (string hex)
 Convert an hexadecimal representation of eight bytes into the actual value. More...
 
static string ToHex (byte val)
 Express one byte in hexadecimal. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string tohex (byte val)
 Express one byte in hexadecimal. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string ToHex (UInt16 val)
 Express two bytes in hexadecimal. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string tohex (UInt16 val)
 Express two bytes in hexadecimal. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string ToHex (UInt32 val)
 Express four bytes in hexadecimal. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string tohex (UInt32 val)
 Express four bytes in hexadecimal. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string ToHex (UInt64 val)
 Express eight bytes in hexadecimal. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string tohex (UInt64 val)
 Express eight bytes in hexadecimal. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string ToHex (byte[] val)
 Express an array of bytes into hexadecimal. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string ToHex (byte[] val, int length)
 Express an array of bytes into hexadecimal, truncating at specified length. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string ToHex (byte[] val, int offset, int length)
 Express an array of bytes into hexadecimal, specifying offset and length. Digits 0xA to 0xF use uppercase ('A' to 'F').
 
static string tohex (byte[] val)
 Express an array of bytes into hexadecimal. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string tohex (byte[] val, int length)
 Express an array of bytes into hexadecimal, truncating at specified length. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string tohex (byte[] val, int offset, int length)
 Express an array of bytes into hexadecimal, specifying offset and length. Digits 0xA to 0xF use lowercase ('a' to 'f').
 
static string ToHex_delim (byte[] val, string delim=", ", string first_delim="", string last_delim="")
 
static string ToHex_C (byte[] val)
 
static string ToHex_nice (byte[] val, string delim, string linePrefix, int bytesPerLine)
 
static string ToHex_nice (byte[] val)
 
static string tohex_delim (byte[] val, string delim=", ", string first_delim="", string last_delim="")
 
static string tohex_C (byte[] val)
 
static string ToHex (byte[] val, uint length)
 
static string tohex (byte[] val, uint length)
 
static string ToHex (byte[] val, uint offset, uint length)
 
static string tohex (byte[] val, uint offset, uint length)
 
static Int32 ParseHexInt32 (string hex)
 
static UInt32 ParseHexUInt32 (string hex)
 
static bool IsHex (string s)
 
static bool IsHex (string s, int wantLength)
 
static bool IsHex (char c)
 
static byte [] DecimalASCII_to_BYTEArray (string ascii_number)
 
static bool isValidHexString (string s)
 
static bool isByte (char c)
 
static int SparseBitcount (int n)
 
static string AsciiToHex (string input)
 "Converts" "HERVE" to "4845525645" More...
 

Detailed Description

Utilities to convert text into numbers or array, and reverse.

Member Function Documentation

◆ AsciiToHex()

static string SpringCard.LibCs.BinConvert.AsciiToHex ( string  input)
static

"Converts" "HERVE" to "4845525645"

Parameters
input
Returns

◆ ByteArrayToString()

static string SpringCard.LibCs.BinConvert.ByteArrayToString ( byte []  val,
bool  stopOnZero = true,
bool  hideNonAscii = false 
)
static

Convert an array of bytes into a string.

◆ ParseHex()

static byte [] SpringCard.LibCs.BinConvert.ParseHex ( string  hex)
static

Convert an hexadecimal representation of an array of bytes into its actual value.

◆ ParseHexB()

static byte SpringCard.LibCs.BinConvert.ParseHexB ( string  hex)
static

Convert an hexadecimal representation of one byte into its actual value.

◆ ParseHexDW()

static UInt32 SpringCard.LibCs.BinConvert.ParseHexDW ( string  hex)
static

Convert an hexadecimal representation of four bytes into their actual value.

◆ ParseHexUInt64()

static UInt64 SpringCard.LibCs.BinConvert.ParseHexUInt64 ( string  hex)
static

Convert an hexadecimal representation of eight bytes into the actual value.

◆ ParseHexW()

static UInt16 SpringCard.LibCs.BinConvert.ParseHexW ( string  hex)
static

Convert an hexadecimal representation of two bytes into their actual value.

◆ ParseInt()

static int SpringCard.LibCs.BinConvert.ParseInt ( string  dec)
static

Convert an decimal representation of an integer into its actual value.

◆ ParseUInt()

static uint SpringCard.LibCs.BinConvert.ParseUInt ( string  dec)
static

Convert an decimal representation of an unsigned integer into its actual value.

◆ StringToByteArray()

static byte [] SpringCard.LibCs.BinConvert.StringToByteArray ( string  str,
bool  includeEndZero = false 
)
static

Convert a string into an array of bytes.


The documentation for this class was generated from the following file: