CamelCase in Standard ML
Example for versions
SML/NJ 110
val text = valOf (TextIO.inputLine TextIO.stdIn);
fun capitalize s = let
val (x::xs) = explode s
in
implode (Char.toUpper x :: map Char.toLower xs)
end;
val result = concat (map capitalize (String.tokens (not o Char.isAlpha) text));
print (result ^ "\n");
Comments
]]>blog comments powered by Disqus
]]>