You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
848 B
35 lines
848 B
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Text;
|
||
|
using System.Text.RegularExpressions;
|
||
|
|
||
|
namespace PDAForm.Comm
|
||
|
{
|
||
|
public class MyMath
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 判断是否为整数型
|
||
|
/// </summary>
|
||
|
/// <param name="inString"></param>
|
||
|
/// <returns></returns>
|
||
|
public static bool IsInt(string inString)
|
||
|
{
|
||
|
Regex regex = new Regex("^[0-9]*[0-9][0-9]*$");
|
||
|
return regex.IsMatch(inString.Trim());
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 判断是否为浮点型
|
||
|
/// </summary>
|
||
|
/// <param name="inString"></param>
|
||
|
/// <returns></returns>
|
||
|
public static bool IsFloat(string inString)
|
||
|
{
|
||
|
Regex regex = new Regex(@"^\d*\.?\d*$");
|
||
|
return regex.IsMatch(inString.Trim());
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|