Brian Dunning's FileMaker Custom Functions

RemoveSmartQuotes ( text )

Removes any single or double smart/curly quotes from the specified text (requires FileMaker v10)

  Average rating: 4.1 (36 votes) Log in to vote

Andrew Duncan   Andrew Duncan - Show more from this author
Databuzz
https://www.databuzz.com.au

Share on Facebook Share on Twitter

  Sample input:
“hello World”
  Sample output:
"hello World"

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

FileMaker Pro has the option per file to use smart quotes which are represented as the curly quotation marks and curly apostrophes which is set via the File menu > File Options>Text tab. These smart quotes can cause problems when interfacing with external systems that don't support smart quotes.

This functions uses the new Char function in FileMaker Pro v10 to remove any single or double smart/curly quotes from the specified text and replace them with plain (straight) quotes and apostrophes. (You can make this function work with previous version of FileMaker by copy/pasting an example of each left/right single and double smart quote/apostrophe into the calculation in place of the Char function).

 

Comments

Bart Bartholomay   Bart Bartholomay, Vero Beach, FL
Feb 8, 2010
Sample input and output don't follow the CF.
 
Andrew Duncan   Andrew Duncan, Databuzz
Feb 8, 2010
Hi Bart,

Thanks for pointing that out, have just updated it to show the correct sample input/output.

regards,
Andrew
 
Stuart Rechter   Stuart Rechter
Feb 4, 2014
Nice work Duncan,

I also learned some syntax tricks within functions.

Saved me some time. :)
 
Charles   Charles, France
Aug 29, 2015
I tried adding french chevron style quotes in the function :

[ Char ( 171 ) ; "\"" ] ; // left pointing guillemet ( « )
[ Char ( 187 ) ; "\"" ] ; // right pointing guillemet ( » )
etc…
[ Char ( 8221) ; "\"" ] // right double smart quote

…but it doesn't work ! If I send it :

"«test»"

the function returns a blank string. I must be having a senior moment, as I can't for the life of me see why ;-)

If I send in :
Quote ("«test»")

… that does work, sort of, as expectedly, it returns ""test"".

If I do :
Substitute ( "«test»" ; ["«" ; "\""] ; ["»" ; "\""] )

that returns "test" without problem, but if i add :

["«" ; "\""] ;
["»" ; "\""] ;
etc…
[ Char ( 8221) ; "\"" ] // right double smart quote

…to the custom function, that doesn't work either.

I checked the character codes, which seem correct.

This makes me wonder whether, for me, it's worth using a custom function at all.
All very odd.
 
Andrew Duncan   Andrew Duncan, Databuzz
Aug 30, 2015
Hi Charles,

I just did some tests using the English version of FileMaker Pro Advanced v13.09 and it's working as expected using your example. If I add:

[ Char ( 171 ) ; "\"" ] ; // left pointing guillemet ( « )
[ Char ( 187 ) ; "\"" ] ; // right pointing guillemet ( » )

it returns the expected result.

Try creating the calculation in the Data Viewer first and see if you can get it to work - that might help identify a possible culprit.
 
Dan Fries   Dan Fries, Daniel Fries Music
Sep 6, 2019
thank you for this Andrew, major help to me!
 

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: