Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created July 13, 2010 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/474421 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/474421 to your computer and use it in GitHub Desktop.
// How about?
let (|NullEmpty|NonNull|) input =
if System.String.IsNullOrEmpty input then NullEmpty else NonNull
let fullName first last =
match first, last with
| NullEmpty, NullEmpty -> failwith "Both first and last cannot be null"
| NonNull, NullEmpty -> first
| NullEmpty, NonNull -> last
| _ -> sprintf "%s.%s" first last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment