Click or drag to resize

Replicate Function

Repeat a string a specified number of times.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION Replicate(
	cString AS STRING,
	dwCount AS DWORD
) AS STRING
View Source

Parameters

cString
Type: String
The string to repeat.
dwCount
Type: UInt32
The number of times to repeat <cString>, up to a maximum of MAX_ALLOC. Specifying a value of zero returns a NULL_STRING.

Return Value

Type: String
Remarks
Replicate() repeatedly displays, prints, or stuffs the keyboard with one or more characters.  Replicate() is like the Space() function, which returns a specified number of space characters.
Examples
These examples demonstrate Replicate() repeating strings:
X#
? Replicate("*", 5)                                        // *****
? Replicate("Hi ", 2)                                // Hi Hi
? Replicate(_Chr(42), 5)                                // *****
This example uses Replicate() to stuff the keyboard with several Down arrow keys:
X#
Keyboard(Replicate(_Chr(K_DN), 5))
See Also