//-----------------
//StringType.IsHexOrOctValue(text1, ref num2))
internal static bool IsHexOrOctValue(string Value, ref long i64Value)
{
int num1;
int num2 = Value.Length;
while (num1 < num2)
{
char ch1 = Value[num1];
if (ch1 == ''&'')
{
ch1 = char.ToLower(Value[num1 + 1], CultureInfo.InvariantCulture);
string text1 = StringType.ToHalfwidthNumbers(Value.Substring(num1 + 2));
if (ch1 == ''h'')
{
i64Value = Convert.ToInt64(text1, 0x10);
}
else if (ch1 == ''o'')
{
i64Value = Convert.ToInt64(text1, 8);
}
else
{
throw new FormatException();
}
return true;
}
if ((ch1 != '' '') && (ch1 != ''\u3000''))
{
return false;
}
num1++;
}
return false;
}
//----------------------------------------------------
// DoubleType.TryParse(text1, ref num1);
internal static bool TryParse(string Value, ref double Result)
{
bool flag1;
CultureInfo info1 = Utils.GetCultureInfo();
NumberFormatInfo info3 = info1.NumberFormat;
NumberFormatInfo info2 = DecimalType.GetNormalizedNumberFormat(info3);
Value = StringType.ToHalfwidthNumbers(Value, info1);
if (info3 == info2)
{
return double.TryParse(Value, NumberStyles.Any, info2, out Result);
}
try
{
Result = double.Parse(Value, NumberStyles.Any, info2);
flag1 = true;
}
catch (FormatException)
{
flag1 = double.TryParse(Value, NumberStyles.Any, info3, out Result);
}
catch (Exception)
{
flag1 = false;
}
return flag1;
}
方案五: 直接引用vb运行库(执行效率不高)
方法: 首先需要添加Visualbasic.runtime的引用
代码中Using Microsoft.visualbasic;
程序中用Information.isnumeric("ddddd");