mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52:21 +02:00
Merge pull request #35 from subramanivmk/beef32
Added StartsWith(char32) & EndsWith(char32).
This commit is contained in:
commit
12ab5a13f6
1 changed files with 21 additions and 1 deletions
|
@ -1723,6 +1723,26 @@ namespace System
|
||||||
return Ptr[mLength - 1] == c;
|
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)
|
public void ReplaceLargerHelper(String find, String replace)
|
||||||
{
|
{
|
||||||
List<int> replaceEntries = scope List<int>(8192);
|
List<int> replaceEntries = scope List<int>(8192);
|
||||||
|
@ -3083,4 +3103,4 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue