Brian Dunning's FileMaker Custom Functions

cfSubstitudeWildCard ( text ; searchString ; replaceString ; start )

Replace all occurrences with wildcard

  Be the first to rate this function Log in to vote

Kadir Kaleli   Kadir Kaleli - Show more from this author
Yordam
http://www.yordam.com

Share on Facebook Share on Twitter

  Sample input:
cfSubstitudeWildCard ( "text|1 text|2 text|abc text|cx" ; "|@" ; "XX" ; 1 )
cfSubstitudeWildCard ( "text|1 text|2 text|abc text|cx" ; "|#" ; "X" ; 1 )
cfSubstitudeWildCard ( "word text world text" ; "r@" ; "" ; 1 )
cfSubstitudeWildCard ( "word text world text" ; "ex@" ; "Y" ; 1 )
cfSubstitudeWildCard ( "word123 text world345 text" ; "d###" ; "" ; 1 )
  Sample output:
textXX textXX textXXbc textXXx
textX textX text|abc text|cx
wo text wod text
word tY world tY
wor text worl text

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

Replace with wildcard
for string use @
for number use #


Use these function together:

cfSubstitudeWildCardIsNumOrText ( _text1 ; _text2 )

Case( Length(_text1) > 0 ;
Case (
Left(_text1;1) = Left(_text2;1) ; 1 ;
Left(_text1;1) = "Ω" ; 1 ;
Left(_text1;1) = "≈" and GetAsNumber(Left(_text2;1)) ≠ "" ; 1 ; 0
) & cfSubstitudeWildCardIsNumOrText (Right(_text1;Length(_text1) -1 ); Right(_text2;Length(_text2) -1 ) )
; _text1
)

 

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 15 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: