mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Libraries/String: Add String.Lower()
This commit is contained in:
@@ -60,6 +60,20 @@ Bool @string_ends_with(U8* fragment, U8* str)
|
|||||||
return !MemCmp(fragment, str + StrLen(str) - StrLen(fragment), StrLen(fragment));
|
return !MemCmp(fragment, str + StrLen(str) - StrLen(fragment), StrLen(fragment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 @string_lower(U8* s)
|
||||||
|
{
|
||||||
|
while (*s) {
|
||||||
|
switch (*s) {
|
||||||
|
case 'A' ... 'Z':
|
||||||
|
*s += 32;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
U8* @string_replace(U8* s, U8* oldW, U8* newW)
|
U8* @string_replace(U8* s, U8* oldW, U8* newW)
|
||||||
{
|
{
|
||||||
if (!StrFind(oldW, s)) {
|
if (!StrFind(oldW, s)) {
|
||||||
@@ -163,6 +177,7 @@ class @string
|
|||||||
Bool (*BeginsWith)(U8* fragment, U8* str);
|
Bool (*BeginsWith)(U8* fragment, U8* str);
|
||||||
Bool (*EndsWith)(U8* fragment, U8* str);
|
Bool (*EndsWith)(U8* fragment, U8* str);
|
||||||
Bool (*IsNumber)(U8* s);
|
Bool (*IsNumber)(U8* s);
|
||||||
|
U0 (*Lower)(U8* s);
|
||||||
U8* (*Replace)(U8* s, U8* oldW, U8* newW);
|
U8* (*Replace)(U8* s, U8* oldW, U8* newW);
|
||||||
U8** (*Split)(U8* s, U8 ch = '\n', I64 * cnt);
|
U8** (*Split)(U8* s, U8 ch = '\n', I64 * cnt);
|
||||||
U0 (*Trim)(U8* s, U8 ch = NULL, I64 mode = TRIM_BOTH);
|
U0 (*Trim)(U8* s, U8 ch = NULL, I64 mode = TRIM_BOTH);
|
||||||
@@ -173,6 +188,7 @@ String.Append = &@string_append;
|
|||||||
String.BeginsWith = &@string_begins_with;
|
String.BeginsWith = &@string_begins_with;
|
||||||
String.EndsWith = &@string_ends_with;
|
String.EndsWith = &@string_ends_with;
|
||||||
String.IsNumber = &@string_is_number;
|
String.IsNumber = &@string_is_number;
|
||||||
|
String.Lower = &@string_lower;
|
||||||
String.Replace = &@string_replace;
|
String.Replace = &@string_replace;
|
||||||
String.Split = &@string_split;
|
String.Split = &@string_split;
|
||||||
String.Trim = &@string_trim;
|
String.Trim = &@string_trim;
|
||||||
|
|||||||
Reference in New Issue
Block a user