Brian Dunning's FileMaker Custom Functions

TruncateStringWithBreaks ( String_with_breaks ; String_without_breaks )

truncates a string at a position, determined by another one

  Average rating: 4.3 (3 votes) Log in to vote

Bernhard Sailer   Bernhard Sailer - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
TruncateStringWithBreaks ( 001 - 43 23 56 - 56678; 0014323 )
  Sample output:
001 - 43 23

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

The script truncates the string_with_breaks at the position, then all values of String_without_breaks were shown in the correct succession.

 

Comments

Lee Smith   Lee Smith
Apr 17, 2017
There was an error in your coding.
My test file did not like the TrunctateStringWithBreaks
for this TruncateStringWithBreaks
Note the difference in Trunctate and Trundate

Also, When corrected, the String_without of 0014323 doesn't work, but 001 - 4323 does.

Lee
 
Lee Smith   Lee Smith
Apr 17, 2017
My auto correct change the spelling of Trunctate to Trundate?
 
Agnès   Agnès, France
Apr 21, 2017
Hi,

Just for fun, I do not test a lot, May be some results are not good, but, I would try this calculation, without recursive.

Let ([

Val = "I just want to t-r-y, w i t h o u t recursion" ;
VSearch = "trywith" ;

Test = Left ( Filter ( Val ; VSearch ) ; Position ( Filter ( Val ; VSearch ) ; VSearch ; 1 ; 1 )-1 ) ;
PosLeftS = Position ( Val ; Left ( VSearch ; 1 ) ; 1 ; PatternCount ( Test ; Left ( VSearch ; 1 ) ) + 1 )

];
Middle ( Val ; PosLeftS ; Position ( Val ; Right ( VSearch ; 1 ) ; PosLeftS ; PatternCount ( VSearch ; Right ( VSearch; 1 ) ) ) - PosLeftS +1
))

result : t-r-y, w i t h

Thanks for exercice ;)
 
Agnès   Agnès, France
Apr 21, 2017
PS : your cf is TruncateXXX but in your calc, you write
TrunctateXXX
^
l
 

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:

Under construction. Email me your wish list for improvements.