Brian Dunning's FileMaker Custom Functions

CamelBreaker ( string ; start ; broken )

Breaks up a camel case string into words.

  Average rating: 4.0 (1 vote) Log in to vote

bigtom   bigtom
bigtom
https://community.filemaker.com/people/bigtom

Share on Facebook Share on Twitter

  Sample input:
CamelBreaker ( "BrokenCamelCase"; 1; "" )
  Sample output:
Broken Camel Case

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Breaks up a camel case string into words by evaluating each characters ASCII and concatenates a new string with spaces as needed.

 

Comments

Joshua Willing   Joshua Willing, Willing Apps
Jul 22, 2018
Cool function!

Not that a camel case string would ever be 50k characters, but this can be handled without recursion too:

Trim (
Substitute ( string ;
[ "A" ; " A" ] ;
[ "B" ; " B" ] ;
[ "C" ; " C" ] ;
[ "D" ; " D" ] ;
[ "E" ; " E" ] ;
[ "F" ; " F" ] ;
[ "G" ; " G" ] ;
[ "H" ; " H" ] ;
[ "I" ; " I" ] ;
[ "J" ; " J" ] ;
[ "K" ; " K" ] ;
[ "L" ; " L" ] ;
[ "M" ; " M" ] ;
[ "N" ; " N" ] ;
[ "O" ; " O" ] ;
[ "P" ; " P" ] ;
[ "Q" ; " Q" ] ;
[ "R" ; " R" ] ;
[ "S" ; " S" ] ;
[ "T" ; " T" ] ;
[ "U" ; " U" ] ;
[ "V" ; " V" ] ;
[ "W" ; " W" ] ;
[ "X" ; " X" ] ;
[ "Y" ; " Y" ] ;
[ "Z" ; " Z" ]
)
)
 
Jonathan Fletcher   Jonathan Fletcher, Fletcher Data Consulting
Aug 19, 2018
Just in case there might be a stray space in the text, I would likely add [ " " ; " " ] as the last substitution to catch them.
 
Jonathan Fletcher   Jonathan Fletcher, Fletcher Data Consulting
Aug 19, 2018
Oops, that was meant for Joshua.
 
Jonathan Fletcher   Jonathan Fletcher, Fletcher Data Consulting
Aug 19, 2018
Like the recursive one better, though.
 
Joshua Willing   Joshua Willing, Willing Apps
Sep 19, 2018
@Jonathan fletcher why is recursion better? Just curious.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: