Brian Dunning's FileMaker Custom Functions

PositionX ( text ; searchString ; start ; occurrence ; matchcase )

extended Position() function that can also work Case Sensitive

  Average rating: 3.9 (37 votes) Log in to vote

Theo Ros   Theo Ros - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
PositionX ( "abcABC" ; "A" ; 1 ; 1 ; True )
  Sample output:
4

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

The Position() function in FM7 is always Case Insensitive...
The Substitute fortunately is not.
If you want a case sensitive Position function, use this one,
with final parameter 'matchcase' set to True (1).

In: text - the textfield or literal string you want examined
searchString - the string to look for
start - the position where to start searching
occurrence - any numeric expression or field containing
a number, representing which instance of
the text string you want to find. A negative
occurrence value causes the scan to go in
the opposite direction from start. A zero
value for occurrence is invalid and returns a result of zero.
matchcase - if set to True (any value not equal to zero)
the function does a Case Sensitive search.
if False (0) the function behaves Case Insensitive

Syntax: PositionX ( text ; searchString ; start ; occurrence ; matchcase )

Return type: Number

(this is an adaptation of the PositionCS() function by Christian Jäger)

 

Comments

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: