Brian Dunning's FileMaker Custom Functions

Repeat ( myText ; Number )

Repeat text a specified number of times

  Average rating: 4.2 (42 votes) Log in to vote

Rob Poelking   Rob Poelking - Show more from this author
Kiza Solutions
https://kizasolutions.com

Share on Facebook Share on Twitter

  Sample input:
Repeat ( "x" ; 5 )
  Sample output:
xxxxx

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

Repeats a character or text string the number of times specified. Useful in padding text.

 

Comments

Heather McCue   Heather McCue, Dallas
Apr 29, 2009
Note that this CF cannot be defined in FileMaker 10 as shown here in due to the introduction of a 'char' function. Modify the parameter name and it works great.

Just what I needed. Quick & Simple!
 
aaron   aaron, san diego, ca
Jun 18, 2009
a shorter version

Case ( repeatCount > 0 ; text & Repeat ( text ; repeatCount - 1 ) )
 
Ibrahim Bittar   Ibrahim Bittar, Leon, Mexico
Oct 13, 2011
Thank you so much, it works like a charm, however, I had to change the parameter "char" by "text", given that char is a reserved word.
 
Rob Poelking   Rob Poelking, Kiza Solutions
Oct 13, 2011
Yes, I wrote the function before FM introduced the Char function. Glad you can use it, I appreciate the feedback.
 
flusheDData   flusheDData, n/a
Feb 13, 2017
A simpler approach for less than 404 repetitions:

Substitute ( 10 ^ Number - 1 ; 9 ; Text )

Kind regards,
 
Walter Whitman Moore   Walter Whitman Moore, Beverly Hills
Sep 21, 2017
You are a genius! I love this! I didn't even know one could create custom functions! THANK YOU BRIAN DUNNING!
 
David   David
Dec 23, 2017
Guys, you make my day...

It's a real pleasure to read such beautiful code, and I can't decide wich one is the most smart beetween Miguel and Aaron... Congratulation to all...
 

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: