]]> ]]>

CamelCase в ML

Пример для версий SML/NJ 110.69
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");

Комментарии

]]>

blog comments powered by Disqus

]]>

Работа программистам