CamelCase в Seed7
Пример для версий
Seed7 2012-01-01
В примере используется посимвольная обработка введенной строки.
$ include "seed7_05.s7i";
const proc: main is func
local
var string: text is "";
var string: camel_case is "";
var char: ch is ' ';
var boolean: was_space is TRUE;
begin
readln(text);
text := lower(text);
for ch range text do
if ch in {'a' .. 'z'} then
if was_space then
ch := upper(ch);
end if;
camel_case &:= ch;
was_space := FALSE;
else
was_space := TRUE;
end if;
end for;
writeln(camel_case);
end func;
Комментарии
]]>blog comments powered by Disqus
]]>