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';
|
2017-08-06 21:12:58 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-11-07 18:08:56 +01:00
|
|
|
|
/// Checks if given character is hexadecimal
|
2017-08-06 21:12:58 +02:00
|
|
|
|
/// </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';
|
2017-11-07 18:08:56 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks if character is between A-Z or a-z
|
|
|
|
|
/// </summary>
|
2017-11-07 19:08:01 +01:00
|
|
|
|
public static bool IsEnglishAlphabet(char ch) => ch >= 'A' && ch <= 'z' && (ch <= 'Z' || ch >= 'a');
|
2016-08-12 14:38:34 +02:00
|
|
|
|
}
|
2017-11-07 19:08:01 +01:00
|
|
|
|
}
|