src/NeinMath/IntegerConverter.cs
/// <summary>
/// Returns an Integer converted from a hex string.
/// </summary>
/// <param name="value">A hex string.</param>
/// <returns>An Integer formed by a hex string.</returns>
Returns an Integer converted from a hex string.
Returns an Integer converted from a hex string .
public static Integer FromHexString(string value)
        {
            if (value == null)
                throw new ArgumentNullException(nameof(value));
            if (value.Length == 0)
                throw new ArgumentOutOfRangeException(nameof(value));
            var sign = value[0] >= '8' ? "F" : "0";
            if (value.Length % 2 == 1)
                value = sign + value;
            var bytes = new byte[value.Length / 2];
            for (var i = 0; i < bytes.Length; i++)
                bytes[i] = byte.Parse(value.Substring(value.Length
                    - (i + 1) * 2, 2), NumberStyles.AllowHexSpecifier,
                    CultureInfo.InvariantCulture);
            return FromByteArray(bytes);
        }
public static Integer FromHexString ( string value ) { if ( value == null ) throw new ArgumentNullException ( nameof ( value ) ) ; if ( value . Length == 0 ) throw new ArgumentOutOfRangeException ( nameof ( value ) ) ; var sign = value [ 0 ] >= ' ' ? " " : " " ; if ( value . Length % 2 == 1 ) value = sign + value ; var bytes = new byte [ value . Length / 2 ] ; for ( var i = 0 ; i < bytes . Length ; i ++ ) bytes [ i ] = byte . Parse ( value . Substring ( value . Length - ( i + 1 ) * 2 , 2 ) , NumberStyles . AllowHexSpecifier , CultureInfo . InvariantCulture ) ; return FromByteArray ( bytes ) ; }
Returns an Integer converted from a hex string.
Returns an Integer converted from a hex string .
An Integer formed by a hex string.
An Integer formed by a hex string .
value
string
A hex string.
A hex string .