static private ParseInt32 ( String s, NumberStyles style, NumberFormatInfo info ) : Int32 | ||
s | String | |
style | NumberStyles | |
info | NumberFormatInfo | |
return | Int32 |
private static short Parse(String s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16"), e); } // We need this check here since we don't allow signs to specified in hex numbers. So we fixup the result // for negative numbers if ((style & NumberStyles.AllowHexSpecifier) != 0) // We are parsing a hexadecimal number { if ((i < 0) || (i > UInt16.MaxValue)) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)i); }
private static sbyte Parse(ReadOnlySpan <char> s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(SR.Overflow_SByte, e); } if ((style & NumberStyles.AllowHexSpecifier) != 0) { // We are parsing a hexadecimal number if ((i < 0) || i > Byte.MaxValue) { throw new OverflowException(SR.Overflow_SByte); } return((sbyte)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException(SR.Overflow_SByte); } return((sbyte)i); }
private static short Parse(ReadOnlySpan <char> s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(SR.Overflow_Int16, e); } // We need this check here since we don't allow signs to specified in hex numbers. So we fixup the result // for negative numbers if ((style & NumberStyles.AllowHexSpecifier) != 0) { // We are parsing a hexadecimal number if ((i < 0) || (i > UInt16.MaxValue)) { throw new OverflowException(SR.Overflow_Int16); } return((short)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException(SR.Overflow_Int16); } return((short)i); }
// Parses an integer from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // /// <include file='doc\Int32.uex' path='docs/doc[@for="Int32.Parse3"]/*' /> public static int Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo info = NumberFormatInfo.GetInstance(provider); NumberFormatInfo.ValidateParseStyle(style); return(Number.ParseInt32(s, style, info)); }
private static short Parse(string s, NumberStyles style, NumberFormatInfo info) { int int32; try { int32 = Number.ParseInt32(s, style, info); } catch (OverflowException ex) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16"), (Exception)ex); } if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None) { if (int32 < 0 || int32 > (int)ushort.MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)int32); } if (int32 < (int)short.MinValue || int32 > (int)short.MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)int32); }
// Token: 0x060012F6 RID: 4854 RVA: 0x00038078 File Offset: 0x00036278 private static sbyte Parse(string s, NumberStyles style, NumberFormatInfo info) { int num = 0; try { num = Number.ParseInt32(s, style, info); } catch (OverflowException innerException) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte"), innerException); } if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None) { if (num < 0 || num > 255) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); } return((sbyte)num); } else { if (num < -128 || num > 127) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); } return((sbyte)num); } }
private static short Parse(string s, NumberStyles style, NumberFormatInfo info) { int num = 0; try { num = Number.ParseInt32(s, style, info); } catch (OverflowException exception) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16"), exception); } if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None) { if ((num < 0) || (num > 0xffff)) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)num); } if ((num < -32768) || (num > 0x7fff)) { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); } return((short)num); }
private static sbyte Parse(String s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte"), e); } if ((style & NumberStyles.AllowHexSpecifier) != 0) { // We are parsing a hexadecimal number if ((i < 0) || i > Byte.MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); } return((sbyte)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); } return((sbyte)i); }
public static int Parse(string s) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo)); }
// Parses an integer from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // public static int Parse(string s, IFormatProvider?provider) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider))); }
// Parses an integer from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // public static int Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseInt32(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider))); }
public static int Parse(string s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseInt32(s, style, NumberFormatInfo.CurrentInfo)); }
// Parses an unsigned byte from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. //| <include path='docs/doc[@for="Byte.Parse3"]/*' /> public static byte Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyle(style); int i = Number.ParseInt32(s, style); if (i < MinValue || i > MaxValue) { throw new OverflowException("Overflow_Byte"); } return((byte)i); }
// Parses an unsigned byte from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. /// <include file='doc\Byte.uex' path='docs/doc[@for="Byte.Parse3"]/*' /> public static byte Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo info = NumberFormatInfo.GetInstance(provider); NumberFormatInfo.ValidateParseStyle(style); int i = Number.ParseInt32(s, style, info); if (i < MinValue || i > MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte")); } return((byte)i); }
public static sbyte Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyle(style); int i = Number.ParseInt32(s, style); if (((style & NumberStyles.AllowHexSpecifier) != 0) && (i <= Byte.MaxValue)) // We are parsing a hexadecimal number { return((sbyte)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException("Overflow_SByte"); } return((sbyte)i); }
private static byte Parse(String s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte"), e); } if (i < MinValue || i > MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte")); } return((byte)i); }
private static byte Parse(string s, NumberStyles style, NumberFormatInfo info) { int int32; try { int32 = Number.ParseInt32(s, style, info); } catch (OverflowException ex) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte"), (Exception)ex); } if (int32 < 0 || int32 > (int)byte.MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte")); } return((byte)int32); }
public static sbyte Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo info = NumberFormatInfo.GetInstance(provider); NumberFormatInfo.ValidateParseStyle(style); int i = Number.ParseInt32(s, style, info); if (((style & NumberStyles.AllowHexSpecifier) != 0) && (i <= Byte.MaxValue)) // We are parsing a hexadecimal number { return((sbyte)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); } return((sbyte)i); }
private static byte Parse(string s, NumberStyles style, NumberFormatInfo info) { int num = 0; try { num = Number.ParseInt32(s, style, info); } catch (OverflowException exception) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte"), exception); } if ((num < 0) || (num > 0xff)) { throw new OverflowException(Environment.GetResourceString("Overflow_Byte")); } return((byte)num); }
private static byte Parse(ReadOnlySpan <char> s, NumberStyles style, NumberFormatInfo info) { int i = 0; try { i = Number.ParseInt32(s, style, info); } catch (OverflowException e) { throw new OverflowException(SR.Overflow_Byte, e); } if (i < MinValue || i > MaxValue) { throw new OverflowException(SR.Overflow_Byte); } return((byte)i); }
//| <include path='docs/doc[@for="Int16.Parse3"]/*' /> public static short Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyle(style); int i = Number.ParseInt32(s, style); // We need this check here since we don't allow signs to specified in hex numbers. So we fixup the result // for negative numbers if (((style & NumberStyles.AllowHexSpecifier) != 0) && (i <= UInt16.MaxValue)) // We are parsing a hexadecimal number { return((short)i); } if (i < MinValue || i > MaxValue) { throw new OverflowException("Overflow_Int16"); } return((short)i); }
public static int Parse(String s) { return(Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo)); }
public static int Parse(string s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo2.ValidateParseStyleInteger(style); return(Number.ParseInt32(s, style, NumberFormatInfo.GetInstance(provider))); }
// Parses an integer from a String in the given style. If // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // /// <include file='doc\Int32.uex' path='docs/doc[@for="Int32.Parse2"]/*' /> public static int Parse(String s, IFormatProvider provider) { NumberFormatInfo info = NumberFormatInfo.GetInstance(provider); return(Number.ParseInt32(s, NumberStyles.Integer, info)); }
public static int Parse(ReadOnlySpan <char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider?provider = null) { NumberFormatInfo.ValidateParseStyleInteger(style); return(Number.ParseInt32(s, style, NumberFormatInfo.GetInstance(provider))); }
//| <include path='docs/doc[@for="Int32.Parse"]/*' /> public static int Parse(String s) { return(Number.ParseInt32(s, NumberStyles.Integer)); }
public static int Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleInteger(style); return(Number.ParseInt32(s, style, NumberFormatInfo.CurrentInfo)); }
public static int Parse(string s, IFormatProvider provider) { return(Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider))); }