aboutsummaryrefslogtreecommitdiff
path: root/code/lib/string.felan
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-06-10 17:23:56 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-06-10 17:23:56 +0330
commit71b4af57bdcc91d948d436a459a223c402a6e17d (patch)
treee22558095e072b6168cb8b6f6bb8235cab00d616 /code/lib/string.felan
parentf6c029cd8842e13069cbd01d2dccc9093f97b8c1 (diff)
add more functions to string
Diffstat (limited to 'code/lib/string.felan')
-rw-r--r--code/lib/string.felan12
1 files changed, 11 insertions, 1 deletions
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;
}
};