Brian Dunning's FileMaker Custom Functions

SeparatorInsert ( text ; separator )

V2. Returns the given text with the separator inserted between all chars.

  Average rating: 4.7 (33 votes) Log in to vote

Andreas Thyholdt   Andreas Thyholdt
dbConsult AS

Share on Facebook Share on Twitter

  Sample input:
SeparatorInsert ( "USD" , "ΒΆ" )
  Sample output:
U
S
D

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

Inserts any character or string as a separator between all characters in the text. I found it useful for displaying vertical text in HTML among other things.

Version 1 was based on DashInsert by Daniele Raybaudi with thanks.

Version 2 is identical to my own comment from March 16, 2011.

 

Comments

Daniele Raybaudi   Daniele Raybaudi, ACI
Feb 20, 2011
Hi
at that time there was not the $var. Try:

Let([
$i = $i + 1 ;
char = Middle ( text ; $i ; 1 )
];
Case(
$i < Length ( text ) ; char & separator & Insert ( text ; separator ) ;
Let( $i = "" ; Right ( text ; 1 ) )
)
)
 
Andreas Thyholdt   Andreas Thyholdt, dbConsult AS
Mar 7, 2011
After further reflection, there is a much simpler way to do this:

Case(Length(text) > 1 ;
Left(text;1) & separator &
SeparatorInsert (Left(text;Length(text) -1 ); separator);
text
)
 
Andreas Thyholdt   Andreas Thyholdt, dbConsult AS
Mar 16, 2011
A typo snuck into the last comment, it should be:

Case(Length(text) > 1 ;
Left(text;1) & separator &
SeparatorInsert (Right(text;Length(text) -1 ); separator);
text
)
 

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.