LeetCode 3174. Clear Digits in F#

URL

Clear Digits - LeetCode

Code

https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/challenge/202502/clear_digits/main.fsx

let clearDigits (s: string) : string =
    s
    |> Seq.fold
        (fun acc c ->
            if System.Char.IsAsciiDigit(c) then
                match acc with
                | [] -> []
                | _ :: t -> t
            else
                c :: acc)
        []
    |> List.rev
    |> System.String.Concat