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:
parent
ddc943876d
commit
edceaadc21
1 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue