hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 97c191b4f4243c11285cd324956fc39de751cf33
parent 2042af21047d33c551a7f85c240fdf50750ef6f7
Author: Bor Grošelj Simić <bgs@turminal.net>
Date:   Tue, 19 Apr 2022 03:57:11 +0200

strings/trim.ha: use the unsafe []u8 -> str conversion variant

Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>

Diffstat:
Mstrings/trim.ha | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/strings/trim.ha b/strings/trim.ha @@ -67,7 +67,7 @@ export fn rtrim(input: str, trim: rune...) str = { break; }; }; - return fromutf8(it.dec.src[..it.dec.offs]); + return fromutf8_unsafe(it.dec.src[..it.dec.offs]); }; // Returns a string (borrowed from given input string) after trimming off of @@ -83,7 +83,7 @@ export fn trim(input: str, exclude: rune...) str = export fn trimprefix(input: str, trim: str) str = { if (!hasprefix(input, trim)) return input; const slice = toutf8(input); - return fromutf8(slice[len(trim)..]); + return fromutf8_unsafe(slice[len(trim)..]); }; // Returns a string (borrowed from given input string) after trimming off the @@ -92,7 +92,7 @@ export fn trimprefix(input: str, trim: str) str = { export fn trimsuffix(input: str, trim: str) str = { if (!hassuffix(input, trim)) return input; const slice = toutf8(input); - return fromutf8(slice[..len(input) - len(trim)]); + return fromutf8_unsafe(slice[..len(input) - len(trim)]); }; @test fn trim() void = {