Click or drag to resize

Replicate Function

X#
Repeat a string a specified number of times.

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

Parameters

cString
Type: String
The string to repeat.
dwCount
Type: DWord
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#
1? Replicate("*", 5)                    // *****
2? Replicate("Hi ", 2)                // Hi Hi
3? Replicate(_Chr(42), 5)                // *****
This example uses Replicate() to stuff the keyboard with several Down arrow keys:
X#
1Keyboard(Replicate(_Chr(K_DN), 5))
See Also