Xbasic
REPLICATE Function
Syntax
Output_String as C = REPLICATE(C substring,N repeat_value)
Arguments
- substring
The character string to be repeated.
- repeat_value
The integer number of times the string should be repeated to create Output_String. Numeric
Description
Duplicates a character a specified number of times.
Discussion
REPLICATE() creates a character string by replicating a substring repeat_value number of times. The resulting character string must be less than 255 characters. Only the integer part of the repeat_value is considered.
Example
replicate("SELL! ",3) -> "SELL! SELL! SELL! "
To index a character field containing numbers in numeric order, you must fill in leading zeros, so that the numbers are right-justified. For example, if CHARFIELD is a 10-character field, create the index using the following expression:
dim cs as C cs = "456" replicate( "0", 10 - len( trim(CHARFIELD) ) ) + CHARFIELD -> "0000000456"
See Also