omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / drafts / rosettacode / remove-vowels-from-a-string.wiki
| 1 | =={{header|Omegese}}== |
| 2 | {{works with|omc|sha256 2c824805, aien-dev/omega-mv e5b32567, Linux AArch64}} |
| 3 | Omega has no imports, so the small output helpers (<code>emit</code> and friends) are part of the program. |
| 4 | <syntaxhighlight lang="text"> |
| 5 | om2 |
| 6 | text nl "\n" |
| 7 | text msg "Rosetta Code is a programming chrestomathy site, AEIOU and aeiou alike." |
| 8 | text vow "aeiouAEIOU" |
| 9 | note emit writes every byte of a to stdout; a short write is retried, an error exits 1 |
| 10 | fn emit a view uchar * to void |
| 11 | o = ulong 0 |
| 12 | while lt o len a bound 4096 |
| 13 | k = write 1 a o sub len a o |
| 14 | if le k 0 |
| 15 | exit 1 |
| 16 | end |
| 17 | o = add o ulong k |
| 18 | end |
| 19 | end |
| 20 | note emitc writes one byte |
| 21 | fn emitc c uchar to void |
| 22 | b = new uchar 1 0 |
| 23 | put b 0 c |
| 24 | emit b |
| 25 | end |
| 26 | fn isvowel c uchar to bool |
| 27 | for i ulong len vow |
| 28 | if eq c get vow i |
| 29 | ret true |
| 30 | end |
| 31 | end |
| 32 | ret false |
| 33 | end |
| 34 | fn main to int |
| 35 | emit msg |
| 36 | emit nl |
| 37 | for i ulong len msg |
| 38 | c = get msg i |
| 39 | if not isvowel c |
| 40 | emitc c |
| 41 | end |
| 42 | end |
| 43 | emit nl |
| 44 | ret 0 |
| 45 | end |
| 46 | </syntaxhighlight> |
| 47 | {{out}} |
| 48 | <pre> |
| 49 | Rosetta Code is a programming chrestomathy site, AEIOU and aeiou alike. |
| 50 | Rstt Cd s prgrmmng chrstmthy st, nd lk. |
| 51 | </pre> |