String.this

Fills the string with n consecutive copies of character chr.

  1. this(S str, Allocator allocator)
  2. this(S init, Allocator allocator)
  3. this(S init, Allocator allocator)
  4. this(Allocator allocator)
  5. this(size_t n, C chr, Allocator allocator)
    struct String
    @trusted
    this
    (
    C
    )
    (
    const size_t n
    ,
    const C chr
    ,)

Parameters

C

Type of the character to fill the string with.

n size_t

Number of characters to copy.

chr C

Character to fill the string with.

allocator Allocator

Allocator.

Examples

{
    auto s = String(1, 'О');
    assert(s.length == 2);
}
{
    auto s = String(3, 'О');
    assert(s.length == 6);
}
{
    auto s = String(8, 'О');
    assert(s.length == 16);
}

Meta