Repeat
Repeats a string a specified number of times.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- String - The string to repeat.
- Count - The number of times to repeat the string (must be non-negative).
Options
This node does not have configurable options.
Output
- Result - The string repeated the specified number of times.
How It Works
The Repeat node creates a new string by repeating the input string:
- Concatenates the string Count times
- Count of 0 returns empty string
- Count of 1 returns the original string
- Negative count causes an error
- Empty string repeated returns empty string
Usage Examples
Example 1: Repeat Character
- String:
"-" - Count:
10 - Result:
"----------"
Example 2: Repeat Word
- String:
"Hello " - Count:
3 - Result:
"Hello Hello Hello "
Example 3: Zero Count
- String:
"Test" - Count:
0 - Result:
""(empty string)
Example 4: Count of One
- String:
"Test" - Count:
1 - Result:
"Test"
Example 5: Repeat Pattern
- String:
"*-" - Count:
5 - Result:
"*-*-*-*-*-"
Error Handling
Negative Count Error:
String: "Test"
Count: -1
Error: "Count cannot be a negative number"
Tips
- Use for creating separators and dividers
- Great for padding strings
- Perfect for visual formatting in reports
- Use for creating patterns
- Combine with GetLength for dynamic padding
- Count of 0 is valid and returns empty string
Common Errors and Solutions
Error: "Count cannot be a negative number"
- Cause: Negative count provided
- Solution: Ensure count is 0 or positive
Error: Result is too long / memory issues
- Cause: Very large count value
- Solution: Validate count is reasonable before repeating
Practical RPA Examples
Example: Create Separator Line
String: "-"
Count: 50
Result: "--------------------------------------------------"
Use: Visual separator in reports or logs
Example: Create Table Border
String: "="
Count: 80
Result: 80 equal signs
Use: Format text-based tables
Example: Padding with Spaces
String: " "
Count: 10
Result: " " (10 spaces)
Use: Indent text or create padding
Example: Create Progress Bar
String: "█"
Count: 7
Result: "███████"
Use: Visual progress indicator (70% of 10)
Example: Create Pattern
String: "+-"
Count: 20
Result: "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
Use: Decorative border
Example: Mask Sensitive Data
String: "*"
Count: 8
Result: "********"
Use: Hide password or sensitive info
Pattern: Dynamic Padding
Create padding based on content:
MaxLength: 20
CurrentLength: 12
PaddingNeeded: 20 - 12 = 8
Repeat " " × 8
Result: " " (8 spaces)
Pattern: Create Divider
Format report sections:
Title: "SECTION 1"
Repeat "-" × 50
Result:
--------------------------------------------------
SECTION 1
--------------------------------------------------
Pattern: Progress Bar
Visual progress indicator:
Progress: 70%
BarLength: 10
FilledCount: 7 (70% of 10)
Repeat "█" × 7 → "███████"
Repeat "░" × 3 → "░░░"
Combined: "███████░░░" (70%)
Pattern: Align Text
Create fixed-width columns:
Value: "Item"
ColumnWidth: 20
ValueLength: 4
SpaceCount: 20 - 4 = 16
Repeat " " × 16
Result: "Item "
Formatting Examples
Report Header
Repeat "=" × 60
Title
Repeat "=" × 60
Result:
============================================================
Monthly Sales Report
============================================================
Table Row
Repeat "-" × 80
Use: Separate table rows
Indentation
Level: 3
Repeat " " × 3 → " " (6 spaces)
Use: Indent code or hierarchical data
Creating Visual Elements
Box Border
Top: Repeat "-" × 40
Side: "|"
Bottom: Repeat "-" × 40
Loading Indicator
Repeat "." × 3 → "..."
Use: "Loading..."
Bullet Points
Repeat " " × level → Indentation
Add "• "
Add text
Use Cases by Category
Formatting
- Report dividers
- Table borders
- Visual separators
Padding
- Fixed-width columns
- Align text
- Create spacing
Masking
- Hide passwords:
******** - Mask credit cards:
****-****-****-1234 - Redact text:
[REDACTED]
Visual Indicators
- Progress bars
- Loading animations
- Rating displays:
★★★★☆
Combining with Other Nodes
With GetLength
GetLength on string
Calculate padding needed
Repeat spaces for padding
Concatenate
With Concatenate
Repeat "-" × 20 → "--------------------"
Concatenate with text
Result: Formatted string with divider
With Template
Use in template: "${separator}"
Where separator is repeated character
Related Nodes
- Concatenate - Combine repeated string with other text
- GetLength - Calculate how many repeats needed
- Join - Alternative for repeating with separator