strideBack

fnuint strideBack(S)(auto ref S str, size_t index) if (is(S : const char[]) || (isRandomAccessRange!S && is(immutable ElementType!S == immutable char)))

Calculate the length of the UTF sequence ending one code unit before index in str.

Parameters

strbidirectional range of UTF code units. Must be random access if index is passed
indexindex one past end of UTF sequence (default: str.length)

Returns

The number of code units in the UTF sequence. For UTF-8, this is a

value between 1 and 4 (as per RFC 3629, section 3). For UTF-16, it is either 1 or 2. For UTF-32, it is always 1.

Throws

May throw a UTFException if str[index] is not one past the

end of a valid UTF sequence.

Note

strideBack will only analyze the element at str[index - 1]

element. It will not fully verify the validity of the UTF sequence, nor even verify the presence of the sequence: it will not actually guarantee that strideBack(str, index) <= index.

fnuint strideBack(S)(auto ref S str) if (is(S : const char[]) || (isRandomAccessRange!S && hasLength!S && is(immutable ElementType!S == immutable char)))

Ditto

fnuint strideBack(S)(auto ref S str) if (isBidirectionalRange!S && is(immutable ElementType!S == immutable char) && !isRandomAccessRange!S)

Ditto

fnuint strideBack(S)(auto ref S str, size_t index) if (is(S : const wchar[]) || (isRandomAccessRange!S && is(immutable ElementType!S == immutable wchar)))

Ditto

fnuint strideBack(S)(auto ref S str) if (is(S : const wchar[]) || (isBidirectionalRange!S && is(immutable ElementType!S == immutable wchar)))

Ditto

fnuint strideBack(S)(auto ref S str, size_t index) if (isRandomAccessRange!S && is(immutable ElementEncodingType!S == immutable dchar))

Ditto

fnuint strideBack(S)(auto ref S str) if (isBidirectionalRange!S && is(immutable ElementEncodingType!S == immutable dchar))

Ditto