Function BasicString.opSlice

Returns a slice [begin .. end]. If the requested substring extends past the end of the string, the returned slice is [begin .. length()].

inout inout(BasicString.CharType)[] opSlice (
  const size_t begin,
  const size_t end
) pure nothrow @nogc @system;

The slice returned may be invalidated by further calls to other member functions that modify the object.

Examples

()@system{
    BasicString!char str = "123456";
    assert(str[1 .. $-1] == "2345");
}();
()@safe{
    FixedString!(char, 20) str = "123456";
    assert(str[1 .. $-1] == "2345");
}();