diff options
| author | gingerBill <bill@gingerbill.org> | 2024-08-19 16:31:03 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-08-19 16:31:03 +0100 |
| commit | 9d7ab8d5ca11acfc3c9b3e67e7f454523f7b6148 (patch) | |
| tree | d6561d614a3b0167894cbc8c83e6fba74e61dbbb /core/strings | |
| parent | 2a0785037b74972f52eddc131309d1e28ef3b8bb (diff) | |
Add `strings.contains_space`
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index c05bdd255..53c33e828 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -346,6 +346,17 @@ Output: contains_any :: proc(s, chars: string) -> (res: bool) { return index_any(s, chars) >= 0 } + + +contains_space :: proc(s: string) -> (res: bool) { + for c in s { + if is_space(r) { + return true + } + } + return false +} + /* Returns the UTF-8 rune count of the string `s` |