Title ( Text ; LeaveEmpty )
This is similar to FileMaker's built-in Proper() function, but much more practical for the real world. It was created with the proper formatting of song titles in mind, but can also be applied to book or movie titles, headlines and more.
Average rating: 3.9 (54 votes) Log in to vote
Howard Schlossberg - Show more from this author
FM Professional Solutions http://fmprosolutions.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This was inspired by the SmarterProper() function (posted on this site by David Tremmel), but whereas that function was more befitting of people's names, I needed something that would also take into consideration that not all words in a song title or headline should be capitalized (ie: a, an, the, and, in, or, etc). And then I realized that some words should always be all upper-case (CD, USA, UK, and certain band names like REM or INXS, etc). So I rewrote David's function from the ground up to accommodate my needs.
This function allows you to easily add additional keywords that should always be lowercase or all-uppercase, depending on your particular needs and/or your users' bad habits.
The function also handles the proper formatting of some names that include some prefixes (ie: McDonald), though it is not properly suited for use with both names and titles (i.e. the prefix 'Mac', as in MacDonald, will also cause the synonym for computer to result in "MacHine"), so be careful here. And it capitalizes the letter after an apostrophe if there are more than just a couple letters after that apostrophe (to handle words like O'Malley without confusing it with Don't).
MORE EXAMPLES:
Title ( "old mcdonald had a farm"; "" ) returns "Old McDonald Had a Farm"
Title ( "o'shea"; "" ) returns "O'Shea"
Title ( "back in the ussr (the beatles)" ; "" ) returns "Back in the USSR (The Beatles)"
Title ( "the world. and more."; "" ) returns "The World. And More."
Title ( "m.i.a."; "" ) returns "M.I.A."
Title ( "19th nervous breakdown"; "" ) results in "19th Nervous Breakdown"
Title ( "more e-mail (don't we love it!)"; "" ) results in "More E-Mail (Don't We Love It!)"
Title ( "LaMond"; "" ) returns LaMond (rather than Lamond; it respects a capital letter that might have intentionally been entered if it comes after a lower-case letter )
Comments
Ricky, Italy Jun 1, 2012 |
||
Hi Howard, thanks for sharing this great function! It works great but I noticed a few exceptions that you may consider to add within the code. This link might be of interest: http://aitech.ac.jp/~ckelly/midi/help/caps.html Check out "Phrasal Verbs"... it would be cool to add an exception list section for specific words ("Call On", "Carry On", "Get By", "Turn On" for example). Unfortunately I'm a newbie when it comes to CF/recursive calcs so I have no idea where to tweak it to make it work! Just an idea, thanks again for this! Very cool! Best, Ricky |
||
Dave Hobson, Bristol UK Aug 7, 2013 |
||
Works really well - very useful. Thanks for sharing. | ||
MW, Hong Kong Sep 13, 2014 |
||
Thank you for sharing this function, it works great except in the following situation: I pass an address to the function, if the address contains more than 7 numerals, then filemaker convert it into a number, e.g. Flat 111A, 2/F, Kin Wang Mansion Stage 2, 111-112 Sai Yee Street, Mongkok, Kowloon. The return is: 1.1122e+10 |
||
MW, Hong Kong Sep 13, 2014 |
||
** Problem solved ** Thank you for sharing this function, it works great except in the following situation: I pass an address to the function, if the address contains more than 7 numerals, then filemaker convert it into a number, e.g. Flat 111A, 2/F, Kin Wang Mansion Stage 2, 111-112 Sai Yee Street, Mongkok, Kowloon. The return is: 1.1122e+10 Problem solved: I use the function as a calculation field and forget to change the output type from number to text, so filemaker attempt to convert the text into a number. |
||
Bryan Olson, Indiana University Oct 13, 2021 |
||
Thanks for sharing this. Does anyone have any tips for how I can modify this function to not capitalize words when they appear after a comma in a list? For example, I have a course title "Foundations of Biology: Diversity, Evolution, And Ecology" where the "evolution" and "and" are continuing to be capitalized when I want it to be lower case. Thanks! | ||
Carlo Vlekken, Vlekken Consult BV Jul 11, 2022 |
||
Copied this function but encountered syntax error in line: nextText = case(isempty(prevText) and Exact( Text, Upper(Text) ), lower(Text), Text); All "," should be ";" : nextText = case(isempty(prevText) and Exact( Text; Upper(Text) ); lower(Text); Text); |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.