Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method str::repeat(self, usize) -> String #36699

Merged
merged 1 commit into from
Oct 12, 2016
Merged

Commits on Oct 10, 2016

  1. Add method str::repeat(self, usize) -> String

    It is relatively simple to repeat a string n times:
    `(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
    complicated to do it “right” (sizing the allocation up front), which
    warrants a method that does it for us.
    
    This method is useful in writing testcases, or when generating text.
    `format!()` can be used to repeat single characters, but not repeating
    strings like this.
    bluss committed Oct 10, 2016
    Configuration menu
    Copy the full SHA
    2b7222d View commit details
    Browse the repository at this point in the history