DeviceManager/DeviceRepairAndOptimization/Common/StringExtended.cs

31 lines
854 B
C#
Raw Permalink Normal View History

2024-05-28 14:36:38 +00:00
namespace DeviceRepairAndOptimization.Common
{
public static class StringExtended
{
/// <summary>
/// 判断字符串是否为空
/// </summary>
/// <param name="Value"></param>
/// <returns></returns>
public static bool IsNullOrWhiteSpace(this string Value)
{
if (!string.IsNullOrWhiteSpace(Value))
return false;
return true;
}
/// <summary>
/// 判断字符串是否为整数型
/// </summary>
/// <param name="Value"></param>
/// <returns></returns>
public static bool IsInt(this string Value)
{
int intValue = 0;
if (!string.IsNullOrWhiteSpace(Value))
return false;
return int.TryParse(Value, out intValue);
}
}
}