1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Added StartsWith(char32) & EndsWith(char32).

This commit is contained in:
subuzero 2020-01-24 00:25:01 +05:30
parent ddc943876d
commit edceaadc21

View file

@ -1723,6 +1723,26 @@ namespace System
return Ptr[mLength - 1] == c;
}
public bool EndsWith(char32 c)
{
int encodedLen = UTF8.GetEncodedLength(c);
char8* ptr = Ptr;
if (mLength == 0)
return false;
let (c32, _) = UTF8.Decode(ptr + mLength - 1 * encodedLen, encodedLen);
return c32 == c;
}
public bool StartsWith(char32 c)
{
int encodedLen = UTF8.GetEncodedLength(c);
char8* ptr = Ptr;
if (mLength == 0)
return false;
let (c32, _) = UTF8.Decode(ptr, encodedLen);
return c32 == c;
}
public void ReplaceLargerHelper(String find, String replace)
{
List<int> replaceEntries = scope List<int>(8192);
@ -3083,4 +3103,4 @@ namespace System
}
}
#endif
}
}