std/lib/io: add Scanner (#904)

* std/lib/io: add Scanner

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/core: use existing methods in String.convert_ascii_to_{lower, upper}

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2023-08-01 10:47:21 +02:00
committed by GitHub
parent a0df1fd728
commit 701d6a0746
3 changed files with 146 additions and 2 deletions

View File

@@ -404,7 +404,7 @@ fn Char32[]! String.to_utf32(s, Allocator* using = mem::heap())
fn void String.convert_ascii_to_lower(s)
{
foreach (&c : s) if (*c >= 'A' && *c <= 'Z') *c += 'a' - 'A';
foreach (&c : s) if (c.is_upper()) *c += 'a' - 'A';
}
fn String String.ascii_to_lower(s, Allocator* using = mem::heap())
@@ -416,7 +416,7 @@ fn String String.ascii_to_lower(s, Allocator* using = mem::heap())
fn void String.convert_ascii_to_upper(s)
{
foreach (&c : s) if (*c >= 'a' && *c <= 'z') *c -= 'a' - 'A';
foreach (&c : s) if (c.is_lower()) *c -= 'a' - 'A';
}
fn String String.ascii_to_upper(s, Allocator* using = mem::heap())