mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add Mixed Case options for byte strings.
This commit is contained in:
parent
d6d4a0db4c
commit
b3f048bfe6
2 changed files with 39 additions and 1 deletions
|
|
@ -9,6 +9,10 @@ public static unsafe partial class ByteStringFunctions
|
|||
.Select( i => ( byte )char.ToLowerInvariant( ( char )i ) )
|
||||
.ToArray();
|
||||
|
||||
private static readonly byte[] AsciiUpperCaseBytes = Enumerable.Range( 0, 256 )
|
||||
.Select( i => ( byte )char.ToUpperInvariant( ( char )i ) )
|
||||
.ToArray();
|
||||
|
||||
// Convert a byte to its ASCII-lowercase version.
|
||||
public static byte AsciiToLower( byte b )
|
||||
=> AsciiLowerCaseBytes[ b ];
|
||||
|
|
@ -17,6 +21,14 @@ public static unsafe partial class ByteStringFunctions
|
|||
public static bool AsciiIsLower( byte b )
|
||||
=> AsciiToLower( b ) == b;
|
||||
|
||||
// Convert a byte to its ASCII-uppercase version.
|
||||
public static byte AsciiToUpper( byte b )
|
||||
=> AsciiUpperCaseBytes[ b ];
|
||||
|
||||
// Check if a byte is ASCII-uppercase.
|
||||
public static bool AsciiIsUpper( byte b )
|
||||
=> AsciiToUpper( b ) == b;
|
||||
|
||||
// Check if a byte array of given length is ASCII-lowercase.
|
||||
public static bool IsAsciiLowerCase( byte* path, int length )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue