Skip to content

Commit 5e0c928

Browse files
authored
Add Remove All Whitespace in F# (#4048)
1 parent dd90d7b commit 5e0c928

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
open System
2+
3+
let removeAllWhitespace (input: string) : string =
4+
input |> Seq.filter (fun c -> not (Char.IsWhiteSpace(c))) |> String.Concat
5+
6+
[<EntryPoint>]
7+
let main argv : int =
8+
let ret = ref 0
9+
10+
if argv.Length = 0 then
11+
12+
printfn "Usage: please provide a string"
13+
ret := 1
14+
else
15+
let input = argv.[0]
16+
if input = "" then
17+
18+
printfn "Usage: please provide a string"
19+
ret := 1
20+
else
21+
let result = removeAllWhitespace input
22+
printfn "%s" result
23+
24+
!ret

0 commit comments

Comments
 (0)