Created
July 13, 2010 17:34
-
-
Save bennage/474213 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
// what's a better way? | |
let fullName (first,last) = | |
match (first, last) with | |
"",_ | null,_ -> first | |
| _,null | _,"" -> last | |
| _ -> sprintf "%s.%s" first last |
let isnullorempty = function
| null -> true
| "" -> true
| _ -> false
let fullname(first,last) =
match isnullorempty first with
| true -> last
| false -> match isnullorempty last with
| true -> first
| false -> sprintf "%s.%s" first last
Matt offered this solution too:
http://gist.github.com/474421
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the logic is