interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / tasks / remove-vowels-from-a-string / remove-vowels-from-a-string.om

43 lines · 831 bytes Raw Blame History
1note Rosetta Code task "Remove vowels from a string": https://rosettacode.org/wiki/Remove_vowels_from_a_string
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3om2
4text nl "\n"
5text msg "Rosetta Code is a programming chrestomathy site, AEIOU and aeiou alike."
6text vow "aeiouAEIOU"
7note emit writes every byte of a to stdout; a short write is retried, an error exits 1
8fn emit a view uchar * to void
9o = ulong 0
10while lt o len a bound 4096
11k = write 1 a o sub len a o
12if le k 0
13exit 1
14end
15o = add o ulong k
16end
17end
18note emitc writes one byte
19fn emitc c uchar to void
20b = new uchar 1 0
21put b 0 c
22emit b
23end
24fn isvowel c uchar to bool
25for i ulong len vow
26if eq c get vow i
27ret true
28end
29end
30ret false
31end
32fn main to int
33emit msg
34emit nl
35for i ulong len msg
36c = get msg i
37if not isvowel c
38emitc c
39end
40end
41emit nl
42ret 0
43end