Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/drafts/rosettacode/strip-whitespace-from-a-string.wiki # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / drafts / rosettacode / strip-whitespace-from-a-string.wiki` 65 lines ยท 1218 bytes Raw Blame History 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 (emit and friends) are part of the program. 4 5 om2 6 text nl "\n" 7 text lb "[" 8 text rb "]" 9 text msg " \t hello world \t\n " 10 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 11 fn emit a view uchar * to void 12 o = ulong 0 13 while lt o len a bound 4096 14 k = write 1 a o sub len a o 15 if le k 0 16 exit 1 17 end 18 o = add o ulong k 19 end 20 end 21 note white: space, tab, newline, vertical tab, form feed, carriage return 22 fn white c uchar to bool 23 ret or eq c 32 and ge c 9 le c 13 24 end 25 fn lead a view uchar * to ulong 26 for i ulong len a 27 if not white get a i 28 ret i 29 end 30 end 31 ret len a 32 end 33 fn trail a view uchar * to ulong 34 for i ulong len a 35 if not white get a sub sub len a 1 i 36 ret sub len a i 37 end 38 end 39 ret 0 40 end 41 fn show a view uchar * to void 42 emit lb 43 emit a 44 emit rb 45 emit nl 46 end 47 fn main to int 48 l = lead msg 49 t = trail msg 50 show msg 51 show part msg l sub len msg l 52 show part msg 0 t 53 show part msg l sub t l 54 ret 0 55 end 56 57 {{out}} 58

59 [ hello world

60 ]

61 [hello world

62 ]

63 [ hello world]

64 [hello world]

65