CamelCase in Seed7
Example for versions
Seed7 2012-01-01
This example uses character-by-character processing.
$ 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;
Comments
]]>blog comments powered by Disqus
]]>