repeat

Repeats the str the specified count number of times.

Usage Scenarios

  • Text Generation: Generate repetitive text, such as borders or patterns.
  • Data Testing: Create test data with repeated strings.

Example

import { repeat } from 'funtool/string'

repeat('hi', 3); // ✅ 'hihihi'
repeat('hi', 0); // ✅ ''

Signature

function repeat(str: string, count: number): string

Parameters

  • str ( string` ): The input string.
  • count ( number` ): The number of times to repeat the string.

Returns

  • ( string ): The repeated string.