SubtitleEdit/libse/CharUtils.cs

22 lines
761 B
C#
Raw Normal View History

2016-08-12 14:38:34 +02:00
namespace Nikse.SubtitleEdit.Core
{
public static class CharUtils
{
/// <summary>
/// Checks if character matches [0-9]
/// </summary>
/// <param name="ch"></param>
2018-01-27 13:50:44 +01:00
public static bool IsDigit(char ch) => ch >= '0' && ch <= '9';
/// <summary>
/// Checks if given character is hexadecimal
/// </summary>
/// <param name="ch"></param>
2018-01-27 13:50:44 +01:00
public static bool IsHexadecimal(char ch) => ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'f' || ch >= 'A' && ch <= 'F';
/// <summary>
/// Checks if character is between A-Z or a-z
/// </summary>
public static bool IsEnglishAlphabet(char ch) => ch >= 'A' && ch <= 'z' && (ch <= 'Z' || ch >= 'a');
2016-08-12 14:38:34 +02:00
}
}