RepeatPlus ( )

Function stats

Average user rating
5.0000
108
148
9999
Support
FileMaker 7.0 +
Date posted
17 December 2008
Last updated
04 February 2009
Version
Recursive function
No

Author Info
 comment

3 functions

Average Rating 4.8

author_avatar



 

Function overview

Prototype

RepeatPlus  ( text;   numberOfTimes )


Parameters

text  any text expression or text field


numberOfTimes  any numeric expression or field containing a number


Description

Tags:  text   repeat  

Repeats text the specified number of times.

This is a simple non-recursive calculation that extends the limit of allowable repeats up to 161,999 (with a plain Substitute ( 10^numberOfTimes - 1 ; "9" ; text ) the limit is 404 repeats, while the obvious recursive function would be limited to 10,000 recursions).

Examples

Sample input

Repeat ( "abc " ; 4 )


Sample output

abc abc abc abc

 

Function code

/*
Repeat function
Repeats text number of times

Author
*COMMENT Visual Realisation

Format
Repeat ( text ; numberOfTimes )

Parameters
text - any text expression or text field
numberOfTimes - integer

Data type returned
text

Description
Repeats text the specified number of times.

This simple non-recursive calculation extends the limit of allowable repeats up to 161,999 (with a plain Substitute ( 10^numberOfTimes - 1 ; "9" ; text ) the limit is 404 repeats, while the obvious recursive function would be limited to 10,000 recursions).

December 14, 2008
*/


Let ( [
a = Div (numberOfTimes; 400 ) ;
b= Mod (numberOfTimes; 400 )
] ;
Case ( a ; Substitute ( 10^a - 1 ; [ "9" ; 10^400 - 1 ] ; [ "9" ; text ] ) ) &
Case ( b ; Substitute ( 10^b - 1 ; "9" ; text ) )
)



// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/148

    Prototype: RepeatPlus( text; numberOfTimes )
    Function Author: comment (http://www.fmfunctions.com/mid/108)
    Last updated: 04 February 2009
    Version: 1.3

*/
// ===================================