Πέμπτη, 29 Ιουλίου 2010 2:49 μμ
napoleon
IsNull in F#
A simple isNull for string functionality with
Active Patterns1 2 3 4 5 6 7 8 9 10 11 12 13 14 | open System
let (|Empty|Null|String|) (s:string) = if s = null then Null elif s.Trim() |> String.IsNullOrEmpty then Empty else String (s.Trim())
let public IsNull (rep: string) (s:string) = match s with | Empty | Null -> rep.ToString() | String _ -> s |
If someone knows why the underlined ToString() is needed I would appreciate it