From d852b0c9485267f247210f3a2f8021e8e2c96232 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Sat, 9 Mar 2019 11:08:50 +0100 Subject: Add win32.get_cwd to return the current working directory --- core/strings/strings.odin | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/strings/strings.odin') diff --git a/core/strings/strings.odin b/core/strings/strings.odin index c8c8e560c..edf288c16 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -329,6 +329,10 @@ is_space :: proc(r: rune) -> bool { return false; } +is_null :: proc(r: rune) -> bool { + return r == 0x0000; +} + index_proc :: proc(s: string, p: proc(rune) -> bool, truth := true) -> int { for r, i in s { if p(r) == truth { @@ -476,3 +480,16 @@ trim_right_space :: proc(s: string) -> string { trim_space :: proc(s: string) -> string { return trim_right_space(trim_left_space(s)); } + +trim_left_null :: proc(s: string) -> string { + return trim_left_proc(s, is_null); +} + +trim_right_null :: proc(s: string) -> string { + return trim_right_proc(s, is_null); +} + +trim_null :: proc(s: string) -> string { + return trim_right_null(trim_left_null(s)); +} + -- cgit v1.2.3