| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c# >> C# pan duan yi ge string shi fou ke yi wei shu zi de ji zhong jie jue fang an

C# pan duan yi ge string shi fou ke yi wei shu zi de ji zhong jie jue fang an

2008-12-13 08:24:25 编辑來源:互联网 评论
 
 
 
本文为【C#判断一个string是否可以为数字的几种解决方案】的拼音翻译版
  fang an yi :Try...Catch( zhi xing xiao lv bu gao )view plaincopy to clipboardprint?
  /// <summary>
  /// ming cheng :IsNumberic
  /// gong neng : pan duan shu ru de shi fou shi shu zi
  /// shen shu :string oText: yuan wen ben
  /// fan hui zhi :bool true: shi false: fou
  /// </summary>
  /// <param name="oText"></param>
  /// <returns></returns>
  private bool IsNumberic(string oText)
  {
  try
  {
  int var1=Convert.ToInt32 (oText);
  return true;
  }
  catch
  {
  return false;
  }
  }
  /// <summary>
  /// ming cheng :IsNumberic
  /// gong neng : pan duan shu ru de shi fou shi shu zi
  /// shen shu :string oText: yuan wen ben
  /// fan hui zhi :bool true: shi false: fou
  /// </summary>
  /// <param name="oText"></param>
  /// <returns></returns>
  private bool IsNumberic(string oText)
  {
  try
  {
  int var1=Convert.ToInt32 (oText);
  return true;
  }
  catch
  {
  return false;
  }
  } fang an er : zheng ze biao da shi ( tui jian )
  a)view plaincopy to clipboardprint?
  using System;
  using System.Text.RegularExpressions;
  public bool IsNumber(String strNumber)
  {
  Regex objNotNumberPattern=new Regex("[^0-9.-]");
  Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*");
  Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*");
  String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
  String strValidIntegerPattern="^([-]|[0-9])[0-9]*$";
  Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")");
  return !objNotNumberPattern.IsMatch(strNumber) &&
  !objTwoDotPattern.IsMatch(strNumber) &&
  !objTwoMinusPattern.IsMatch(strNumber) &&
  objNumberPattern.IsMatch(strNumber);
  }
  using System;
  using System.Text.RegularExpressions;
  public bool IsNumber(String strNumber)
  {
  Regex objNotNumberPattern=new Regex("[^0-9.-]");
  Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*");
  Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*");
  String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
  String strValidIntegerPattern="^([-]|[0-9])[0-9]*$";
  Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")");
  return !objNotNumberPattern.IsMatch(strNumber) &&
  !objTwoDotPattern.IsMatch(strNumber) &&
  !objTwoMinusPattern.IsMatch(strNumber) &&
  objNumberPattern.IsMatch(strNumber);
  }b)view plaincopy to clipboardprint?
  public static bool IsNumeric(string value)
  {
  return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
  }
  public static bool IsInt(string value)
  {
  return Regex.IsMatch(value, @"^[+-]?\d*$");
  }
  public static bool IsUnsign(string value)
  {
  return Regex.IsMatch(value, @"^\d*[.]?\d*$");
  }
  public static bool IsNumeric(string value)
  {
  return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
  }
  public static bool IsInt(string value)
  {
  return Regex.IsMatch(value, @"^[+-]?\d*$");
  }
  public static bool IsUnsign(string value)
  {
  return Regex.IsMatch(value, @"^\d*[.]?\d*$");
  } fang an san : bian li www.devdao.com
  a)view plaincopy to clipboardprint?
  public bool isnumeric(string str)
  {
  char[] ch=new char[str.Length];
  ch=str.ToCharArray();
  for(int i=0;i<ch.Length;i++)
  {
  if(ch[i]<48 || ch[i]>57)
  return false;
  }
  return true;
  }
  public bool isnumeric(string str)
  {
  char[] ch=new char[str.Length];
  ch=str.ToCharArray();
  for(int i=0;i<ch.Length;i++)
  {
  if(ch[i]<48 || ch[i]>57)
  return false;
  }
  return true;
  }b)view plaincopy to clipboardprint?
  public bool IsInteger(string strIn) {
  bool bolResult=true;
  if(strIn=="") {
  bolResult=false;
  }
  else {
  foreach(char Char in strIn) {
  if(char.IsNumber(Char))
  continue;
  else {
  bolResult=false;
  break;
  }
  }
  }
  return bolResult;
  }
  public bool IsInteger(string strIn) {
  bool bolResult=true;
  if(strIn=="") {
  bolResult=false;
  }
  else {
  foreach(char Char in strIn) {
  if(char.IsNumber(Char))
  continue;
  else {
  bolResult=false;
  break;
  }
  }
  }
  return bolResult;
  }c)view plaincopy to clipboardprint?
  public static bool isNumeric(string inString)
  {
  inString=inString.Trim();
  bool haveNumber=false;
  bool haveDot=false;
  for(int i=0;i<inString.Length;i++)
  {
  if (Char.IsNumber(inString[i]))
  {
  haveNumber=true;
  }
  else if(inString[i]=='.')
  {
  if (haveDot)
  {
  return false;
  }
  else
  {
  haveDot=true;
  }
  }
  else if(i==0)
  {
  if(inString[i]!='+'&&inString[i]!='-')
  {
  return false;
  }
  }
  else
  {
  return false;
  }
  if(i>20)
  {
  return false;
  }
  }
  return haveNumber;
  }
  }
  public static bool isNumeric(string inString)
  {
  inString=inString.Trim();
  bool haveNumber=false;
  bool haveDot=false;
  for(int i=0;i<inString.Length;i++)
  {
  if (Char.IsNumber(inString[i]))
  {
  haveNumber=true;
  }
  else if(inString[i]=='.')
  {
  if (haveDot)
  {
  return false;
  }
  else
  {
  haveDot=true;
  }
  }
  else if(i==0)
  {
  if(inString[i]!='+'&&inString[i]!='-')
  {
  return false;
  }
  }
  else
  {
  return false;
  }
  if(i>20)
  {
  return false;
  }
  }
  return haveNumber;
  }
  } fang an si : gai xie vb de IsNumeric yuan dai ma ( zhi xing xiao lv bu gao )view plaincopy to clipboardprint?
  // zhu tiao han shu
  public static bool IsNumeric(object Expression)
  {
  bool flag1;
  IConvertible convertible1 = null;
  if (Expression is IConvertible)
  {
  convertible1 = (IConvertible) Expression;
  }
  if (convertible1 == null)
  {
  if (Expression is char[])
  {
  Expression = new string((char[]) Expression);
  }
  else
  {
  return false;
  }
  }
  TypeCode code1 = convertible1.GetTypeCode();
  if ((code1 != TypeCode.String) && (code1 != TypeCode.Char))
  {
  return Utils.IsNumericTypeCode(code1);
  }
  string text1 = convertible1.ToString(null);
  try
  {
  long num2;
  if (!StringType.IsHexOrOctValue(text1, ref num2))
  {
  double num1;
  return DoubleType.TryParse(text1, ref num1);
  }
  flag1 = true;
  }
  catch (Exception)
  {
  flag1 = false;
  }
  return flag1;
  }
  // zi han shu
  // return Utils.IsNumericTypeCode(code1);
  internal static bool IsNumericTypeCode(TypeCode TypCode)
  {
  switch (TypCode)
  {
  case TypeCode.Boolean:
  case TypeCode.Byte:
  case TypeCode.Int16:
  case TypeCode.Int32:
  case TypeCode.Int64:
  case TypeCode.Single:
  case TypeCode.Double:
  case TypeCode.Decimal:
  {
  return true;
  }
  case TypeCode.Char:
  case TypeCode.SByte:
  case TypeCode.UInt16:
  case TypeCode.UInt32:
  case TypeCode.UInt64:
  {
  break;
  }
  }
  return false;
  }
  
  //-----------------
  //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;
  }
  // zhu tiao han shu
  public static bool IsNumeric(object Expression)
  {
  bool flag1;
  IConvertible convertible1 = null;
  if (Expression is IConvertible)
  {
  convertible1 = (IConvertible) Expression;
  }
  if (convertible1 == null)
  {
  if (Expression is char[])
  {
  Expression = new string((char[]) Expression);
  }
  else
  {
  return false;
  }
  }
  TypeCode code1 = convertible1.GetTypeCode();
  if ((code1 != TypeCode.String) && (code1 != TypeCode.Char))
  {
  return Utils.IsNumericTypeCode(code1);
  }
  string text1 = convertible1.ToString(null);
  try
  {
  long num2;
  if (!StringType.IsHexOrOctValue(text1, ref num2))
  {
  double num1;
  return DoubleType.TryParse(text1, ref num1);
  }
  flag1 = true;
  }
  catch (Exception)
  {
  flag1 = false;
  }
  return flag1;
  }
  // zi han shu
  // return Utils.IsNumericTypeCode(code1);
  internal static bool IsNumericTypeCode(TypeCode TypCode)
  {
  switch (TypCode)
  {
  case TypeCode.Boolean:
  case TypeCode.Byte:
  case TypeCode.Int16:
  case TypeCode.Int32:
  case TypeCode.Int64:
  case TypeCode.Single:
  case TypeCode.Double:
  case TypeCode.Decimal:
  {
  return true;
  }
  case TypeCode.Char:
  case TypeCode.SByte:
  case TypeCode.UInt16:
  case TypeCode.UInt32:
  case TypeCode.UInt64:
  {
  break;
  }
  }
  return false;
  }
  //-----------------
  //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;
  } fang an wu : zhi jie yin yong vb yun xing ku ( zhi xing xiao lv bu gao )
  fang fa : shou xian xu yao tian jia Visualbasic.runtime de yin yong
  dai ma zhong Using Microsoft.visualbasic;
  cheng xu zhong yong Information.isnumeric("ddddd");【原文】【汉音对照
 
 
 
 
 
 
 
 196.*.*.* 发表于2012-07-21 10:08:14
  Just do me a favor and keep writing such trenchant anlayess, OK?
  回复
  
  
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
fang an yi :Try...Catch( zhi xing xiao lv bu gao )view plaincopy to clipboardprint? /// <summary> /// ming cheng :IsNumberic /// gong neng : pan duan shu ru de shi fou shi shu zi /// shen shu :string oText: yuan wen ben /// fan hui zhi : bool true: shi  false: fou /// </summary> /// <param name="oText"></param> /// <returns></returns> private bool IsNumberic(string oText) { try { int var1=Convert.ToInt32 (oText); return true; } catch { return false; } } /// <summary> /// ming cheng :IsNumberic /// gong neng : pan duan shu ru de shi fou shi shu zi /// shen shu :string oText: yuan wen ben /// fan hui zhi : bool true: shi  false: fou /// </summary> /// <param name="oText"></param> /// <returns></returns> private bool IsNumberic(string oText) { try { int var1=Convert.ToInt32 (oText); return true; } catch { return false; } } fang an er : zheng ze biao da shi ( tui jian ) a)view plaincopy to clipboardprint? using System; using System.Text.RegularExpressions; public bool IsNumber(String strNumber) { Regex objNotNumberPattern=new Regex("[^0-9.-]"); Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*"); Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*"); String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$"; String strValidIntegerPattern="^([-]|[0-9])[0-9]*$"; Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")"); return !objNotNumberPattern.IsMatch(strNumber) && !objTwoDotPattern.IsMatch(strNumber) && !objTwoMinusPattern.IsMatch(strNumber) && objNumberPattern.IsMatch(strNumber); } using System; using System.Text.RegularExpressions; public bool IsNumber(String strNumber) { Regex objNotNumberPattern=new Regex("[^0-9.-]"); Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*"); Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*"); String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$"; String strValidIntegerPattern="^([-]|[0-9])[0-9]*$"; Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")"); return !objNotNumberPattern.IsMatch(strNumber) && !objTwoDotPattern.IsMatch(strNumber) && !objTwoMinusPattern.IsMatch(strNumber) && objNumberPattern.IsMatch(strNumber); }b)view plaincopy to clipboardprint? public static bool IsNumeric(string value) { return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$"); } public static bool IsInt(string value) { return Regex.IsMatch(value, @"^[+-]?\d*$"); } public static bool IsUnsign(string value) { return Regex.IsMatch(value, @"^\d*[.]?\d*$"); } public static bool IsNumeric(string value) { return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$"); } public static bool IsInt(string value) { return Regex.IsMatch(value, @"^[+-]?\d*$"); } public static bool IsUnsign(string value) { return Regex.IsMatch(value, @"^\d*[.]?\d*$"); } fang an san : bian li [url=http://www.devdao.com]www.devdao.com[/url] a)view plaincopy to clipboardprint? public bool isnumeric(string str) { char[] ch=new char[str.Length]; ch=str.ToCharArray(); for(int i=0;i<ch.Length;i++) { if(ch[i]<48 || ch[i]>57) return false; } return true; } public bool isnumeric(string str) { char[] ch=new char[str.Length]; ch=str.ToCharArray(); for(int i=0;i<ch.Length;i++) { if(ch[i]<48 || ch[i]>57) return false; } return true; }b)view plaincopy to clipboardprint? public bool IsInteger(string strIn) { bool bolResult=true; if(strIn=="") { bolResult=false; } else { foreach(char Char in strIn) { if(char.IsNumber(Char)) continue; else { bolResult=false; break; } } } return bolResult; } public bool IsInteger(string strIn) { bool bolResult=true; if(strIn=="") { bolResult=false; } else { foreach(char Char in strIn) { if(char.IsNumber(Char)) continue; else { bolResult=false; break; } } } return bolResult; }c)view plaincopy to clipboardprint? public static bool isNumeric(string inString) { inString=inString.Trim(); bool haveNumber=false; bool haveDot=false; for(int i=0;i<inString.Length;i++) { if (Char.IsNumber(inString[i])) { haveNumber=true; } else if(inString[i]=='.') { if (haveDot) { return false; } else { haveDot=true; } } else if(i==0) { if(inString[i]!='+'&&inString[i]!='-') { return false; } } else { return false; } if(i>20) { return false; } } return haveNumber; } } public static bool isNumeric(string inString) { inString=inString.Trim(); bool haveNumber=false; bool haveDot=false; for(int i=0;i<inString.Length;i++) { if (Char.IsNumber(inString[i])) { haveNumber=true; } else if(inString[i]=='.') { if (haveDot) { return false; } else { haveDot=true; } } else if(i==0) { if(inString[i]!='+'&&inString[i]!='-') { return false; } } else { return false; } if(i>20) { return false; } } return haveNumber; } } fang an si : gai xie vb de IsNumeric yuan dai ma ( zhi xing xiao lv bu gao )view plaincopy to clipboardprint? // zhu tiao han shu public static bool IsNumeric(object Expression) { bool flag1; IConvertible convertible1 = null; if (Expression is IConvertible) { convertible1 = (IConvertible) Expression; } if (convertible1 == null) { if (Expression is char[]) { Expression = new string((char[]) Expression); } else { return false; } } TypeCode code1 = convertible1.GetTypeCode(); if ((code1 != TypeCode.String) && (code1 != TypeCode.Char)) { return Utils.IsNumericTypeCode(code1); } string text1 = convertible1.ToString(null); try { long num2; if (!StringType.IsHexOrOctValue(text1, ref num2)) { double num1; return DoubleType.TryParse(text1, ref num1); } flag1 = true; } catch (Exception) { flag1 = false; } return flag1; } // zi han shu // return Utils.IsNumericTypeCode(code1); internal static bool IsNumericTypeCode(TypeCode TypCode) { switch (TypCode) { case TypeCode.Boolean: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: { return true; } case TypeCode.Char: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: { break; } } return false; } //----------------- //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; } // zhu tiao han shu public static bool IsNumeric(object Expression) { bool flag1; IConvertible convertible1 = null; if (Expression is IConvertible) { convertible1 = (IConvertible) Expression; } if (convertible1 == null) { if (Expression is char[]) { Expression = new string((char[]) Expression); } else { return false; } } TypeCode code1 = convertible1.GetTypeCode(); if ((code1 != TypeCode.String) && (code1 != TypeCode.Char)) { return Utils.IsNumericTypeCode(code1); } string text1 = convertible1.ToString(null); try { long num2; if (!StringType.IsHexOrOctValue(text1, ref num2)) { double num1; return DoubleType.TryParse(text1, ref num1); } flag1 = true; } catch (Exception) { flag1 = false; } return flag1; } // zi han shu // return Utils.IsNumericTypeCode(code1); internal static bool IsNumericTypeCode(TypeCode TypCode) { switch (TypCode) { case TypeCode.Boolean: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: { return true; } case TypeCode.Char: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: { break; } } return false; } //----------------- //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; } fang an wu : zhi jie yin yong vb yun xing ku ( zhi xing xiao lv bu gao ) fang fa : shou xian xu yao tian jia Visualbasic.runtime de yin yong dai ma zhong Using Microsoft.visualbasic; cheng xu zhong yong Information.isnumeric("ddddd");
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
玉美人_珠联璧合
清纯美女米卡
清新靓丽的早晨
玲子的自信与性感
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有