Brian Dunning's FileMaker Custom Functions

FirstCapitalPosition ( text ; textLength )

finds first capital letter position in text

  Average rating: 4.7 (31 votes) Log in to vote

Marc Wood   Marc Wood
studentpress.org
http://studentpress.org

Share on Facebook Share on Twitter

  Sample input:
Let (
theText = "xxxxXxx" ;
FirstCapitalPosition ( theText ; Length ( theText ) )
)
  Sample output:
5

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

Recursively finds position of first capital letter in text. Necessary because FileMaker's native Position function is not case-sensitive. FileMaker 10 or later required ( uses the Code function ).

Used by CamelCasePrefix function: http://www.briandunning.com/cf/1312

 

Comments

unin   unin, japan
May 26, 2011
Case ( Filter ( text ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) = "" ; 0 ;
Case( Filter ( Left( text; 1 ); "ABCDEFGHIJKLMNOPQRSTUVWXYZ") <> ""; 1;
1 + FirstCapitalPosition( Replace( text; 1; 1; ""))
)
)
 
Agnès   Agnès, France
May 27, 2011
or

Let ([

txt = "camelCase" ;
M = Filter ( txt ; Upper ( Txt ) )
];
Length ( GetValue ( Substitute ( txt ; left ( M ; 1 ) ; ¶ ) ; 1 ) )
)

with a test if not IsEmpty ( M )
 
Daniele Raybaudi   Daniele Raybaudi, ACI
May 27, 2011
or

Position ( Substitute ( text ; Left ( Filter ( text ; Upper ( KanjiNumeral ( text ) ) ) ; 1 ) ; "§§§" ) ; "§§§" ; 1 ; 1 )
 
unin   unin, japan
May 29, 2011
Thanks for good ideas.

My "A-Z" is used insted of Code function in original code.
That is usable in case of universal text containing any chars, not only camelCase ic text.
But in some languages, more chars should be included as 'Capital'.
 

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 20 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: