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.
The name, camel case, comes from the uppercase "bumps" in the middle of the compound word, suggestive of the humps of a camel.
Challenge: Un-Camel-Case a String
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.
For example, if camel is "FirstYearSalary", the result "First Year Salary". If camel is "SavedFileName" the result is "Saved File Name".
Some special cases:
camel = "delphi" | result = "delphi"
camel = "ILoveDelphi" | result = "I Love Delphi"
camel = "ABOUTDELPHI" | result = "ABOUTDELPHI"
Both the speed of execution and code simplicity will be tested -I'm not sure now what "code simplicity" means :)
Accepted Entries
Here's the list of the accepted entries. 25 entries were accepted before the challenge was closed.This challenge was a simple one, therefore I'm giving 5 points of fame and glory to all who participated :))
Some entries are faster some are slower, some use chars, some strings, some even use ASM...
Download all accepted entries + test application
Developers that submitted an accepted entry:
Korhan Ta kar - Turkey
Kelver Merlotti - Brazil
Miguel Gastelumendi - Brazil
Joachim Walz - Sweden
Mike Heydon - South Africa
Domi Kovacs - Germany
Boris Kumpar - Croatia
Diego Campos Rosa - Brazil
Jim Murtha - USA
Miodrag Martinic - Germany
ReneDohmen - The Netherlands
Attila Petrilla - Canada
Joachim Knoell -
Dagan Hoover -
Colin Banwell - France
Dave Sonsalla - USA
Alex Kazanskiy - USA
Joseph Styons - USA
Peter Hildebrand - Germany
Guy Savoie - USA
Pablo Gietz - Argentina
Henk van Loo Jnr - Republic of South-Africa
Daniel Fuchs - Germany
Claude Sutterlin - USA
Alex Francis - UK
Carlos Ruben Vega Barreras - Mexico
Anthony Kelsall - Australia
Challenge CLOSED!
Note: this challenge is closed. Several valid entries have been submitted before the challenge was closed.Delphi programming challenges / exercises are designed to help you refactor your old code to make it more efficient; get new ideas on how to code faster / better Delphi code; help you solve a particular Delphi programming task and of course: to have fun while coding in Delphi :)
