Skip to content

Instantly share code, notes, and snippets.

View saerosV's full-sized avatar
🌳
Improving

Guilherme Marz Vazzolla saerosV

🌳
Improving
View GitHub Profile
@saerosV
saerosV / remove_char.sml
Last active February 14, 2021 04:29
A simple SML function that removes a given character from a given string.
(* string -> string -> string
* Takes a string and an one letter string (char), produces a string with all the
* ocurrences of char removed. *)
fun remove_char str char =
let
val str_lst = List.map (fn x => String.str x) (String.explode str)
in
concat (List.filter(fn s => not(s = char)) str_lst)
end