fork(2) download
  1. open System;
  2. open System.IO;
  3. open System.Text.RegularExpressions;
  4.  
  5. (*Tests if an element is in a list*)
  6. let isInList elementToFind listToCheck =
  7. List.fold(fun a b -> a || b = elementToFind) false listToCheck;
  8.  
  9. (*Takes a string and filters it down to common text characters*)
  10. let filterWord wordToFilter =
  11. Regex.Replace(wordToFilter, "[^a-zA-Z0-9/!'?.-]", "");
  12.  
  13. let input = "### $$$ Alice In Wonderland ,,,,";
  14. let unfilteredWords = input.Split(' ');
  15. let filteredWords = unfilteredWords |> Array.map(fun x -> filterWord(x));
  16. printfn "%A" filteredWords;
Success #stdin #stdout 0.23s 25680KB
stdin
Standard input is empty
stdout
[|""; ""; "Alice"; "In"; "Wonderland"; ""|]