2019-08-23 11:56:54 -07:00
|
|
|
namespace System
|
|
|
|
{
|
2020-08-10 14:45:11 -07:00
|
|
|
#unwarn
|
2021-12-04 14:32:44 -03:00
|
|
|
struct Char8 : char8, ICharacter, IHashable, IIsNaN
|
2019-08-23 11:56:54 -07:00
|
|
|
{
|
|
|
|
bool IIsNaN.IsNaN
|
|
|
|
{
|
|
|
|
[SkipCall]
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public char8 ToLower
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if ((this >= 'A') && (this <= 'Z'))
|
|
|
|
return (char8)((this - 'A') + 'a');
|
|
|
|
return (char8)this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public char8 ToUpper
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if ((this >= 'a') && (this <= 'z'))
|
|
|
|
return (char8)((this - 'a') + 'A');
|
|
|
|
return (char8)this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsLower
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return ((this >= 'a') && (this <= 'z'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsUpper
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return ((this >= 'A') && (this <= 'Z'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsWhiteSpace
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
// U+0009 = HORIZONTAL TAB
|
|
|
|
// U+000a = LINE FEED
|
|
|
|
// U+000b = VERTICAL TAB
|
|
|
|
// U+000c = FORM FEED
|
|
|
|
// U+000d = CARRIAGE RETURN
|
|
|
|
switch (this)
|
|
|
|
{
|
|
|
|
case ' ', '\t', '\n', '\r': return true;
|
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsDigit
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return ((this >= '0') && (this <= '9'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsLetterOrDigit
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (((this >= 'A') && (this <= 'Z')) || ((this >= 'a') && (this <= 'z')) || ((this >= '0') && (this <= '9')));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsLetter
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (((this >= 'A') && (this <= 'Z')) || ((this >= 'a') && (this <= 'z')));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsNumber
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return ((this >= '0') && (this <= '9'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsControl
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return ((this >= (char8)0) && (this <= (char8)0x1F)) || ((this >= (char8)0x7F) && (this <= (char8)0x9F));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:41:14 -08:00
|
|
|
public int GetHashCode()
|
2019-08-23 11:56:54 -07:00
|
|
|
{
|
|
|
|
return (int32)this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void ToString(String strBuffer)
|
|
|
|
{
|
|
|
|
strBuffer.Append((char8)this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|