FOLLOW UP: ProperSentence FileMaker Custom Function

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

A scant two days ago, I posted a challenge on the FileMaker Thought Bucket about a sentence cleaner custom function and David Head of UlearnIT answered the call! Thank you David. Check out UlearnIT at http://ulearnit.com.au/ .

Custom Function Challenge ... Sentence Upper Case Cleaner
It is quite common for a client to respond to my documentation with their text in bold red uppercase format. This is to help me see what their response was to my question or proposal. This is great but it makes it more difficult to copy / paste their input back into the master documentation. Wanted a custom function to clean this up for me. David sent us this ....

/*
Function: ProperSentence ( text )
Purpose: changes a string of text into proper sentences where the first character after a full stop (period) is capitalised and all other characters are lowercase.
Author: David Head, uLearnIT 2008
*/

Let ([
period1 = Position ( text ; "." ; 1 ; 1 );
period2 = Position ( text ; "." ; period1 ; 1 );
sentence = Left ( text; period1 );
sentLen = Length (sentence);
sentence = Upper ( Left ( sentence; 1 ) ) & Lower ( Middle ( sentence; 2; sentLen - 1 ) );
text = Trim ( Middle ( text ; period1 + 1 ; Length ( text ) - period1 ) )
];

Case (
not period1 ;
Upper ( Left ( text; 1 ) ) & Lower ( Middle ( text; 2; Length ( text ) - 1 ) ) ;
period2 ;
sentence & " " & ProperSentence ( text )
)
)

Absolutely wonderful and I used it immediately. One thing that I didn’t say was that I wanted as well was the text to be black and without any style. David had already did all the heavy lifting, so all I needed to do was wrap his calculation within a couple text formatting functions ( TextColor & TextStyleAdd )

An example file can be downloaded at ...
/blogfiles08/sentenceCleaner.zip
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.