public static sbyte Parse(String s, IFormatProvider provider) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Parse(s.AsReadOnlySpan(), NumberStyles.Integer, NumberFormatInfo.GetInstance(provider))); }
public static Decimal Parse(String s, IFormatProvider provider) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseDecimal(s.AsReadOnlySpan(), NumberStyles.Number, provider)); }
public static sbyte Parse(String s) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Parse(s.AsReadOnlySpan(), NumberStyles.Integer, NumberFormatInfo.CurrentInfo)); }
private static sbyte Parse(String s, NumberStyles style, NumberFormatInfo info) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Parse(s.AsReadOnlySpan(), style, info)); }
public static Boolean TryParse(String s, out Decimal result) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.TryParseDecimal(s.AsReadOnlySpan(), NumberStyles.Number, null, out result)); }
// // Static Methods // // Determines whether a String represents true or false. // public static Boolean Parse(String value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(Parse(value.AsReadOnlySpan())); }
public static Boolean TryParse(String input, IFormatProvider formatProvider, out TimeSpan result) { if (input == null) { result = default(TimeSpan); return(false); } return(TimeSpanParse.TryParse(input.AsReadOnlySpan(), formatProvider, out result)); }
public static Boolean TryParse(String s, out TimeSpan result) { if (s == null) { result = default(TimeSpan); return(false); } return(TimeSpanParse.TryParse(s.AsReadOnlySpan(), null, out result)); }
public static TimeSpan ParseExact(String input, String[] formats, IFormatProvider formatProvider, TimeSpanStyles styles) { ValidateStyles(styles, nameof(styles)); if (input == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.input); } return(TimeSpanParse.ParseExactMultiple(input.AsReadOnlySpan(), formats, formatProvider, styles)); }
public static TimeSpan Parse(String s) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.input); } /* Constructs a TimeSpan from a string. Leading and trailing white space characters are allowed. */ return(TimeSpanParse.Parse(s.AsReadOnlySpan(), null)); }
public static Boolean TryParseExact(String input, String[] formats, IFormatProvider formatProvider, out TimeSpan result) { if (input == null) { result = default(TimeSpan); return(false); } return(TimeSpanParse.TryParseExactMultiple(input.AsReadOnlySpan(), formats, formatProvider, TimeSpanStyles.None, out result)); }
public static Decimal Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseDecimal(s.AsReadOnlySpan(), style, NumberFormatInfo.CurrentInfo)); }
public static double Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseDouble(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider))); }
public static ushort Parse(String s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Parse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider))); }
public static Decimal Parse(String s, NumberStyles style, IFormatProvider provider) { ValidateParseStyleFloatingPoint(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseDecimal(s.AsReadOnlySpan(), style, provider)); }
public static long Parse(String s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } return(Number.ParseInt64(s.AsReadOnlySpan(), style, NumberFormatInfo.CurrentInfo)); }
public static bool TryParse(String s, out double result) { if (s == null) { result = 0; return(false); } return(TryParse(s.AsReadOnlySpan(), NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.CurrentInfo, out result)); }
public static Boolean TryParse(String s, out Int64 result) { if (s == null) { result = 0; return(false); } return(Number.TryParseInt64(s.AsReadOnlySpan(), NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result)); }
public static Boolean TryParse(String s, NumberStyles style, IFormatProvider provider, out Decimal result) { ValidateParseStyleFloatingPoint(style); if (s == null) { result = 0; return(false); } return(Number.TryParseDecimal(s.AsReadOnlySpan(), style, provider, out result)); }
public static Boolean TryParse(String s, out Decimal result) { if (s == null) { result = 0; return(false); } return(Number.TryParseDecimal(s.AsReadOnlySpan(), NumberStyles.Number, null, out result)); }
public static Boolean TryParseExact(String input, String format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result) { ValidateStyles(styles, nameof(styles)); if (input == null) { result = default(TimeSpan); return(false); } return(TimeSpanParse.TryParseExact(input.AsReadOnlySpan(), format, formatProvider, styles, out result)); }
// Determines whether a String represents true or false. // public static Boolean TryParse(String value, out Boolean result) { if (value == null) { result = false; return(false); } return(TryParse(value.AsReadOnlySpan(), out result)); }
public static bool TryParse(String s, out UInt16 result) { if (s == null) { result = 0; return(false); } return(TryParse(s.AsReadOnlySpan(), NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result)); }
public static Boolean TryParse(String s, NumberStyles style, IFormatProvider provider, out Single result) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); if (s == null) { result = 0; return(false); } return(TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result)); }
public static bool TryParse(String s, NumberStyles style, IFormatProvider provider, out UInt16 result) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) { result = 0; return(false); } return(TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result)); }
public static Boolean TryParse(String input, out DateTimeOffset result) { TimeSpan offset; DateTime dateResult; Boolean parsed = DateTimeParse.TryParse(input.AsReadOnlySpan(), DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out dateResult, out offset); result = new DateTimeOffset(dateResult.Ticks, offset); return(parsed); }
// Constructs a DateTimeOffset from a string. The string must specify a // date and optionally a time in a culture-specific or universal format. // Leading and trailing whitespace characters are allowed. // public static DateTimeOffset Parse(String input) { if (input == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.index); // TODO: index => input } TimeSpan offset; DateTime dateResult = DateTimeParse.Parse(input.AsReadOnlySpan(), DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out offset); return(new DateTimeOffset(dateResult.Ticks, offset)); }
public static DateTimeOffset Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) { styles = ValidateStyles(styles, nameof(styles)); if (input == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.index); // TODO: index => input } TimeSpan offset; DateTime dateResult = DateTimeParse.Parse(input.AsReadOnlySpan(), DateTimeFormatInfo.GetInstance(formatProvider), styles, out offset); return(new DateTimeOffset(dateResult.Ticks, offset)); }
public static Boolean TryParse(String input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) { styles = ValidateStyles(styles, nameof(styles)); if (input == null) { result = default(DateTimeOffset); return(false); } TimeSpan offset; DateTime dateResult; Boolean parsed = DateTimeParse.TryParse(input.AsReadOnlySpan(), DateTimeFormatInfo.GetInstance(formatProvider), styles, out dateResult, out offset); result = new DateTimeOffset(dateResult.Ticks, offset); return(parsed); }
public static bool TryParse(ReadOnlySpan <char> value, out bool result) { ReadOnlySpan <char> trueSpan = TrueLiteral.AsReadOnlySpan(); if (StringSpanHelpers.Equals(trueSpan, value, StringComparison.OrdinalIgnoreCase)) { result = true; return(true); } ReadOnlySpan <char> falseSpan = FalseLiteral.AsReadOnlySpan(); if (StringSpanHelpers.Equals(falseSpan, value, StringComparison.OrdinalIgnoreCase)) { result = false; return(true); } // Special case: Trim whitespace as well as null characters. value = TrimWhiteSpaceAndNull(value); if (StringSpanHelpers.Equals(trueSpan, value, StringComparison.OrdinalIgnoreCase)) { result = true; return(true); } if (StringSpanHelpers.Equals(falseSpan, value, StringComparison.OrdinalIgnoreCase)) { result = false; return(true); } result = false; return(false); }