/// <summary> /// Convert float string value in float value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <returns>float value</returns> public static float TryParseFloat(this string strValue, float defaultValue) { return(strValue.TryParseFloat(defaultValue, BasePrimitivesExtensions.GetDefaultFloatAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultFloatNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert double string value in double value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <returns>double value</returns> public static double TryParseDouble(this string strValue, double defaultValue) { return(strValue.TryParseDouble(defaultValue, BasePrimitivesExtensions.GetDefaultDoubleAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert string value to long value /// </summary> /// <param name="strValue">string value to convert</param> /// <returns>long value</returns> public static long TryParseLong(this string strValue) { return(strValue.TryParseLong(BasePrimitivesExtensions.GetDefaultLongConversionValue(), BasePrimitivesExtensions.GetDefaultLongAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultLongNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Parse string array in long array /// </summary> /// <param name="strValue">string to parse</param> /// <param name="defaultValue">default value when default tryparse</param> /// <returns>long array</returns> public static long[] TryParseLongArray(this string strValue, long[] defaultValue) { return(strValue.TryParseLongArray(defaultValue, BasePrimitivesExtensions.GetDefaultLongArrayAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultLongNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert string value to int value /// </summary> /// <param name="strValue">string value to convert</param> /// <returns>int value</returns> public static int TryParseInt(this string strValue) { return(strValue.TryParseInt(BasePrimitivesExtensions.GetDefaultIntConversionValue(), BasePrimitivesExtensions.GetDefaultIntAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultIntNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert decimal string value in decimal value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <returns>decimal value</returns> public static decimal TryParseDecimal(this string strValue, decimal defaultValue) { return(strValue.TryParseDecimal(defaultValue, BasePrimitivesExtensions.GetDefaultDecimalAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultDecimalNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert string byte value to byte value /// </summary> /// <param name="strValue">string value</param> /// <returns>byte value</returns> public static byte TryParseByte(this string strValue) { return(strValue.TryParseByte(BasePrimitivesExtensions.GetDefaultByteConversionValue(), BasePrimitivesExtensions.GetDefaultByteAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultByteNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Parse string array in short array /// </summary> /// <param name="strValue">string to parse</param> /// <returns>short array</returns> public static short[] TryParseShortArray(this string strValue) { return(strValue.TryParseShortArray(null, BasePrimitivesExtensions.GetDefaultShortArrayAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultShortNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// <para>Try parse object double to double value</para> /// </summary> /// <param name="objValue">object to convert</param> /// <param name="defaultValue">default return value</param> /// <returns>double result</returns> public static double TryParseDouble(this object objValue, double defaultValue) { if (objValue == null) { return(defaultValue); } try { return(objValue.ToString().TryParseDouble(defaultValue, BasePrimitivesExtensions.GetDefaultDoubleAllowDefaultConversion(), BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); } catch (Exception e) { Debug.WriteLine(e); return(defaultValue); } }
/// <summary> /// Convert double string value in double value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <param name="allowZero">allow 0 valuen on convert</param> /// <returns>double value</returns> public static double TryParseDouble(this string strValue, double defaultValue, bool allowZero) { return(strValue.TryParseDouble(defaultValue, allowZero, BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Test if string value is a valid double value /// </summary> /// <param name="strValue">string value</param> /// <returns>true/false</returns> public static bool IsValidDouble(this string strValue) { return(strValue.IsValidDouble( BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Parse string array in double array /// </summary> /// <param name="strValue">string to parse</param> /// <param name="defaultValue">default value when default tryparse</param> /// <param name="allowDefaultConversion">Allow default tryparse values</param> /// <returns>double array</returns> public static double[] TryParseDoubleArray(this string strValue, double[] defaultValue, bool allowDefaultConversion) { return(strValue.TryParseDoubleArray(defaultValue, allowDefaultConversion, BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert float string value in float value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <param name="allowZero">allow 0 valuen on convert</param> /// <returns>float value</returns> public static float TryParseFloat(this string strValue, float defaultValue, bool allowZero) { return(strValue.TryParseFloat(defaultValue, allowZero, BasePrimitivesExtensions.GetDefaultFloatNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert string value to long value /// </summary> /// <param name="strValue">string value to convert</param> /// <param name="defaultValue">default value when error on convert value</param> /// <param name="allowZero">allow zero on convert</param> /// <returns>long value</returns> public static long TryParseLong(this string strValue, long defaultValue, bool allowZero) { return(strValue.TryParseLong(defaultValue, allowZero, BasePrimitivesExtensions.GetDefaultLongNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }
/// <summary> /// Convert decimal string value in decimal value /// </summary> /// <param name="strValue">string to convert</param> /// <param name="defaultValue">default value to return on convert error</param> /// <param name="allowZero">allow 0 valuen on convert</param> /// <returns>decimal value</returns> public static decimal TryParseDecimal(this string strValue, decimal defaultValue, bool allowZero) { return(strValue.TryParseDecimal(defaultValue, allowZero, BasePrimitivesExtensions.GetDefaultDecimalNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture())); }