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/tasks/strip-a-set-of-characters-from-a-string/strip-a-set-of-characters-from-a-string.om # 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 / tasks / strip-a-set-of-characters-from-a-string / strip-a-set-of-characters-from-a-string.om` 43 lines ยท 879 bytes Raw Blame History 1 note Rosetta Code task "Strip a set of characters from a string": https://rosettacode.org/wiki/Strip_a_set_of_characters_from_a_string 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 om2 4 text nl "\n" 5 text msg "She was a soul stripper. She took my heart!" 6 text set1 "aei" 7 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 8 fn emit a view uchar * to void 9 o = ulong 0 10 while lt o len a bound 4096 11 k = write 1 a o sub len a o 12 if le k 0 13 exit 1 14 end 15 o = add o ulong k 16 end 17 end 18 note emitc writes one byte 19 fn emitc c uchar to void 20 b = new uchar 1 0 21 put b 0 c 22 emit b 23 end 24 note stripchars writes the bytes of a that are not in set s 25 fn strip a view uchar * s view uchar * to void 26 for i ulong len a 27 c = get a i 28 k = true 29 for j ulong len s 30 if eq c get s j 31 k = false 32 end 33 end 34 if k 35 emitc c 36 end 37 end 38 emit nl 39 end 40 fn main to int 41 strip msg set1 42 ret 0 43 end