Strip control codes and extended characters from a string: Difference between revisions
Strip control codes and extended characters from a string (view source)
Revision as of 18:59, 10 December 2022
, 1 year agosimplification for OCaml
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
m (simplification for OCaml) |
||
Line 1,547:
<syntaxhighlight lang="ocaml">let is_control_code c =
let is_extended_char c =
▲ d > 127
let strip f str =
let len = String.length str in
Line 1,559 ⟶ 1,557:
let rec aux i j =
if i >= len
then Bytes.
else if f str.[i]
then aux (succ i) j
Line 1,568 ⟶ 1,566:
in
aux 0 0
let () =
Random.self_init ();
Line 1,577 ⟶ 1,575:
in
print_endline (strip is_control_code s);
print_endline (strip (fun c ->
=={{header|Pascal}}==
|