Brian Dunning's FileMaker Custom Functions

FindDuplicateCharacters ( string )

Returns True if the given string

  Average rating: 5.0 (1 vote) Log in to vote

RealGrouchy   RealGrouchy
http://twitter.com/RealGrouchy

Share on Facebook Share on Twitter

  Sample input:
FindDuplicateCharacters ( "1234561"
  Sample output:
True

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

There are plenty of functions out there to find and manipulate unique or duplicate values within a given list of ΒΆ delimited values, but I couldn't find anything that looked for duplicate *characters* within a string. I whipped this one up.

It's simple enough but I figured I'll upload it for the next person who goes looking for it. It took me more time to look for it than to recreate it because I assumed there *must* be one out there! There probably is one and I just didn't use the right search terms.

- RG>

 

Comments

esc   esc, tokyo
Jun 11, 2018
=1
would be better if
<=1

now this function get into infinite loop if parameter is shorter than 1 character (then get ? as result).
 
RealGrouchy   RealGrouchy
Jun 11, 2018
Good catch. I've submitted the change!

- RG>
 
Tom Hays   Tom Hays, Virgina, USA
Aug 17, 2018
If the characters in the string are limited to a specific range/set of characters that you can specify explicitly, e.g. 0-9a-zA-Z, then you can write this in a closed form without needing recursion.

Let([
alphanum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
];
Length(Filter(alphanum; string)) <> Length(string)
)

-Tom
 

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.