Initializerswift 6.0.1Swift

    init(repeating:count:)

    Creates a string representing the given character repeated the specified number of times.

    init(repeating repeatedValue: Character, count: Int)

    Parameters

    repeatedValue

    The character to repeat.

    count

    The number of times to repeat repeatedValue in the resulting string.

    For example, use this initializer to create a string with ten "0" characters in a row.

    let zeroes = String(repeating: "0" as Character, count: 10)
    print(zeroes)
    // Prints "0000000000"

    Other members in extension

    Types

    Typealiases

    Show obsolete interfaces (2)

    Hide obsolete interfaces

    Type members

    Show obsolete interfaces (17)

    Hide obsolete interfaces

    Instance members

    Show obsolete interfaces (3)

    Hide obsolete interfaces