From 71b4af57bdcc91d948d436a459a223c402a6e17d Mon Sep 17 00:00:00 2001 From: A404M Date: Tue, 10 Jun 2025 17:23:56 +0330 Subject: add more functions to string --- code/lib/string.felan | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'code/lib/string.felan') diff --git a/code/lib/string.felan b/code/lib/string.felan index 4b5452f..789b0fb 100644 --- a/code/lib/string.felan +++ b/code/lib/string.felan @@ -67,6 +67,16 @@ _grow_if_needed :: (this:*String, count:u64) -> void { } }; +slice :: (this:String, begin:i64, end:i64) -> String { + result:String = undefined; + + result.ptr = this.ptr + begin; + result.size = @cast(end-begin,u64); + result.capacity = 0u64; + + return result; +}; + delete :: (this:String) -> void { free(this.ptr); }; @@ -74,7 +84,7 @@ delete :: (this:String) -> void { print :: (this:String) -> void { i := 0u64; while i < this.size { - @putc(this[i]); + print_char(this[i]); i += 1u64; } }; -- cgit v1.2.3