Skip to main content

repeat_str

Function repeat_str 

Source
pub fn repeat_str(s: &str, n: usize) -> String
Expand description

Repeats a given string a specified number of times.

§Arguments

  • s - A string slice to be repeated
  • n - The number of times to repeat the string

§Returns

A String containing the repeated string

§Examples

let result = repeat_str("abc", 3);
assert_eq!(result, "abcabcabc");