Brian Dunning's FileMaker Custom Functions

StrMatch ( string1 ; string2 ; comparemethod ; matchcase )

StrMatch makes it easier to compare to textfields.

  Average rating: 3.8 (40 votes) Log in to vote

Theo Ros   Theo Ros
*
http://notapplicable.com

Share on Facebook Share on Twitter

  Sample input:
StrMatch ( "AbcDef" ; "Def" ; "cn" ; True )
  Sample output:
True (1)

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

StrMatch makes it easier to compare to textfields.
With parameters 'comparemethod' and 'matchcase', various comparisons
can be performed.
The function returns a boolean number:
False (0) means both strings do not match
True (1) means the match is found

In: string1 - the textfield or literal string you want examined
string2 - the textfield or string you want to match against string1
comparemethod - a string containing one of the following commands:
eq - test if string 1 and string 2 are equal
neq - test if string 1 and string 2 are NOT equal
bw - test if string 1 begins with string 2
cn - test if string 1 contains string 2
ew - test if string 1 ends with string 2
gt - test if string 1 is greater than string 2
gte - test if string 1 is greater than or equal to string 2
lt - test if string 1 is less than string 2
gt - test if string 1 is less than or equal to string 2

matchcase - if set to True (any value not equal to zero)
the function does a Case Sensitive compare.
if False (0) the function behaves Case Insensitive

If an invalid comparemethod is given, the function compares for Equality

Syntax: StrMatch ( string1 ; string2 ; comparemethod ; matchcase )

Return type: Number (boolean)

 

Comments

Anon   Anon, lol
Mar 10, 2011
How would I import this in filemaker pro 8 advanced?
Or is there already a version like this in Filemaker Pro 8 Advanced?

If so could you send me into the right direction. I only need the "cn" method.
 
Theo Ros   Theo Ros, Hilversum
Mar 10, 2011
Hi Anon,

i do not have pro 8 advanced, but i think this functio should work in that version aswell.

Have you tried adding it to your custom functions?

Theo Ros
 
Tjebbe van Tijen   Tjebbe van Tijen, Amsterdam
Jun 19, 2015
Great! this solved a problem that was even with some 'work--arounds' not solvable, as Filemaker Pro 11 does not have a clear function for exact comparison of strings... I had to clean up thousands of fields in a bibliographical database and peel out all those small variations made by typists/cataloguers over years (those without a proper library education and without proper tools)... my parsing script works perfect now... thanks again! Theo Ros
 
Theo Ros   Theo Ros, Hilversum
Jun 22, 2015
You're welcome!
 

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.

Under construction. Email me your wish list for improvements.