System.Number.TryParseUInt32 C# (CSharp) Method

TryParseUInt32() static private method

static private TryParseUInt32 ( String s, NumberStyles style, NumberFormatInfo info, UInt32 &result ) : Boolean
s String
style NumberStyles
info NumberFormatInfo
result UInt32
return Boolean
        internal unsafe static Boolean TryParseUInt32(String s, NumberStyles style, NumberFormatInfo info, out UInt32 result) {

            Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
            NumberBuffer number = new NumberBuffer(numberBufferBytes);
            result = 0;
    
            if (!TryStringToNumber(s, style, ref number, info, false)) {
                return false;
            }

            if ((style & NumberStyles.AllowHexSpecifier) != 0) {
                if (!HexNumberToUInt32(ref number, ref result)) { 
                    return false;
                }
            }
            else {
                if (!NumberToUInt32(ref number, ref result)) {
                    return false;
                }
            }
            return true;           
        }

Usage Example

示例#1
0
        public static bool TryParse(String s, out UInt32 result)
        {
            if (s == null)
            {
                result = 0;
                return(false);
            }

            return(Number.TryParseUInt32(s.AsReadOnlySpan(), NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result));
        }
All Usage Examples Of System.Number::TryParseUInt32