FirstCapitalPosition ( text ; textLength )
finds first capital letter position in text
Average rating: 4.7 (31 votes) Log in to vote
Marc Wood studentpress.org http://studentpress.org |
theText = "xxxxXxx" ;
FirstCapitalPosition ( theText ; Length ( theText ) )
)
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, japan May 26, 2011 |
||
Case ( Filter ( text ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) = "" ; 0 ; Case( Filter ( Left( text; 1 ); "ABCDEFGHIJKLMNOPQRSTUVWXYZ") <> ""; 1; 1 + FirstCapitalPosition( Replace( text; 1; 1; "")) ) ) |
||
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, ACI May 27, 2011 |
||
or Position ( Substitute ( text ; Left ( Filter ( text ; Upper ( KanjiNumeral ( text ) ) ) ; 1 ) ; "§§§" ) ; "§§§" ; 1 ; 1 ) |
||
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'. |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.