/// <summary> /// Is numeric /// </summary> /// <param name="string"></param> /// <returns></returns> public static bool IsNumeric(this string @string) => NumericJudgment.IsNumeric(@string);
/// <summary> /// 指示指定的字符串是否为 Int 类型 /// </summary> /// <param name="string"></param> /// <returns></returns> public static bool IsInt(this string @string) => NumericJudgment.IsInt32(@string);
public void IsNumericTest_False(string str) { Assert.False(NumericJudgment.IsNumeric(str)); }
public void IsNumericTest_True(string str) { Assert.True(NumericJudgment.IsNumeric(str)); }
public void IsInt32Test_False(string str) { Assert.False(NumericJudgment.IsInt32(str)); }
/// <summary> /// 检查整数是否越界 /// </summary> /// <param name="argument"></param> /// <param name="min"></param> /// <param name="max"></param> /// <param name="argumentName"></param> /// <param name="message"></param> public static void IsNotOutOfRange(int argument, int min, int max, string argumentName, string message = null) { AssertionJudgment.Require2 <ArgumentOutOfRangeException>( NumericJudgment.IsBetween(argument, min, max), argumentName, argument, message ?? $"{nameof(argument)} is not between {min} and {max}."); }