---
name: "repeat"
section: "3tcl"
platform: "linux"
package: "tcllib"
version: "2.0+dfsg-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/repeat/3tcl"
---

# repeat(3tcl)

Procedures to repeat strings.

```

```

## NAME

textutil::repeat - Procedures to repeat strings.

## SYNOPSIS

package require **Tcl 8.5 9**

package require **textutil::repeat ?0.8?**

**::textutil::repeat::strRepeat** *text* *num*

**::textutil::repeat::blank** *num*

```

```

## DESCRIPTION

The package **textutil::repeat** provides commands to generate long strings by repeating a shorter string many times.

The complete set of procedures is described below.

- **::textutil::repeat::strRepeat** *text* *num*

  This command returns a string containing the *text* repeated *num* times. The repetitions are joined without characters between them. A value of *num* \<= 0 causes the command to return an empty string.

  *Note*: If the Tcl core the package is loaded in provides the command **string repeat** then this command will be implemented in its terms, for maximum possible speed. Otherwise a fast implementation in Tcl will be used.

- **::textutil::repeat::blank** *num*

  A convenience command. Returns a string of *num* spaces.

## BUGS, IDEAS, FEEDBACK

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category *textutil* of the *Tcllib Trackers* \[http://core.tcl.tk/tcllib/reportlist\]. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide *unified diffs*, i.e the output of **diff -u**.

Note further that *attachments* are strongly preferred over inlined patches. Attachments can be made by going to the **Edit** form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

## SEE ALSO

[regexp(3tcl)](/regexp/3tcl.md), [split(3tcl)](/split/3tcl.md), [string(3tcl)](/string/3tcl.md)

## KEYWORDS

blanks, repetition, string

## CATEGORY

Text processing
