Advertisement
Guest User

Untitled

a guest
Jan 28th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.55 KB | None | 0 0
  1. let suffixesToDrop = ["a";"b"];
  2. let shouldNormalize = true;
  3.  
  4. let clearSuffix (input:string) (suffix:string) =
  5.       match (input:string) with
  6.       | input when input.EndsWith(suffix) -> input.[0..(input.Length-suffix.Length)]
  7.       | _ -> input
  8.      
  9. let clearSuffixes input =
  10.    List.fold clearSuffix input suffixesToDrop
  11.  
  12. let normalizeSlashes (input:string) =
  13.     input.Replace ('/', '\\')
  14.  
  15. let processString input:string =
  16.    match shouldNormalize with
  17.    | true -> normalizeSlashes input |> clearSuffixes
  18.    | false -> clearSuffixes input
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement