in Delphi Challenges :: 
According to Delphi Naming Conventions local variables and method names should use camel casing.
Camel casing is a convention for capitalizing identifiers where the first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. Examples inculde: MySuperWebSite, DelphiSoureCode, FirstYearSalary, etc.
Your challenge is to code a custom Delphi function with the following signature:
function UnCamelCase(const camel: string) : string;
UnCamelCase takes one parameter: camel that is a string value. The function should return a string that has been "de-camel-cased" - where "words" are separated by a space character.
Read the full article to learn how to join this Delphi Challenge: Create an Algorithm To Un-Camel-Case a CamelCase String
Related:


This challenge can prove to be slightly difficult. However, it is fun. You should give it a try!
My solution was very simple, and I found a few glitches in it. Nevertheless, it works.
this contest(from what I see) is very simple to accomplish,
…
var i : integer;
words : array of string; // array where we keep the words
indexes : array of integer; // indexes of first uppercase char
begin
for i := 1 to Length(theString) do
if theString[i] in ['A'..'Z'] then begin
// calling setLength so many times is bad for performance, find a better way!
setLength(words, Length(words) +1);
setLength(indexes, Length(indexes) +1);
indexes[i] := i;
if i > 0 then // this means that this is at least the second word
word[i] := Copy(theString, indexes[i-1], i -1);
// and so on, I will not show you the full implementation, this is just an idea
end;
end;
Code it up and submit it by e-mail if you think you have a good solution!
Zarko awarded everyone points. Here was my submission:
Function UnCamelCase(const camel : string) : string;
Var i: integer;
begin
result := camel;
for i := length(result) downto 2 do
if (result[i-1] in ['a'..'z']) and (result[i] in ['A'..'Z']) then
insert(’ ‘,result,i);
end;
This was pretty compact code, but there were others who compacted even better, but the one who won the speed challenge was not concerned with compactness as much as speed. I was surprised at how fast his code ran.
You can download the results from everyone and compare them. Great stuff for learning, I liked Jim Murtha’s test for caps.
Dave