Created
July 13, 2010 20:02
-
-
Save mattpodwysocki/474421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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