mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-06-20 09:38:16 +08:00
refactor: ♻️ 2.0 (#3)
This commit is contained in:
23
src/backend/NSExt/Extensions/CharExtensions.cs
Normal file
23
src/backend/NSExt/Extensions/CharExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// CharExtensions
|
||||
/// </summary>
|
||||
public static class CharExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否数字或大小写字母
|
||||
/// </summary>
|
||||
public static bool IsAsciiLetterOrDigit(this char me)
|
||||
{
|
||||
return (((uint)me - 'A') & ~0x20) < 26 || (uint)me - '0' < 10;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否base64字符
|
||||
/// </summary>
|
||||
public static bool IsBase64Character(this char me)
|
||||
{
|
||||
return IsAsciiLetterOrDigit(me) || me is '+' or '/' or '=';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user