mirror of
https://github.com/odin-lang/Odin.git
synced 2026-03-08 17:45:36 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -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 {
|
||||
@@ -478,6 +482,19 @@ trim_space :: proc(s: string) -> string {
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
// returns a slice of sub-strings into `s`
|
||||
// `allocator` is used only for the slice
|
||||
// `skip_empty=true` does not return zero-length substrings
|
||||
|
||||
Reference in New Issue
Block a user