std.utf.stride
- multiple declarations
- Function stride
- Function stride
- Function stride
Function stride
returns the length of the UTF-32 sequence starting at stride
in index
.
str
works with both UTF-32 strings and ranges of stride
dchar
.
Prototype
uint stride(S)( S str, size_t index = 0 ) if (is(S : const(dchar[])) || isInputRange!S && is(Unqual!(ElementEncodingType!S) == dchar));
Returns
The number of bytes in the UTF-32 sequence (always 1
).
Throws
Never.
Function stride
returns the length of the UTF-16 sequence starting at stride
in index
.
str
works with both UTF-16 strings and ranges of stride
wchar
. If no
index
is passed, then an input range will work, but if an index
is passed,
then a random-access range is required.
defaults to index
0
if none is passed.
Prototypes
uint stride(S)( S str, size_t index ) if (is(S : const(wchar[])) || isRandomAccessRange!S && is(Unqual!(ElementType!S) == wchar)); uint stride(S)( S str ) pure @safe if (is(S : const(wchar[])));
Returns
The number of bytes in the UTF-16 sequence.
Throws
May throw a
if UTFException
is not the start of a
valid UTF-16 sequence.
str
[index
]
Notes
will only analyze the first stride
element. It
will not fully verify the validity of UTF-16 sequence, nor even verify
the presence of the sequence: it will not actually guarantee that
str
[index
]
.
index
+ stride
(str
, index
) <= str.length
Function stride
returns the length of the UTF-8 sequence starting at stride
in index
.
str
works with both UTF-8 strings and ranges of stride
char
. If no
index
is passed, then an input range will work, but if an index
is passed,
then a random-access range is required.
defaults to index
0
if none is passed.
Prototypes
uint stride(S)( S str, size_t index ) if (is(S : const(char[])) || isRandomAccessRange!S && is(Unqual!(ElementType!S) == char)); uint stride(S)( S str ) if (is(S : const(char[])) || isInputRange!S && is(Unqual!(ElementType!S) == char));
Returns
The number of bytes in the UTF-8 sequence, a value between 1 and 4 (as per RFC 3629).
Throws
May throw a
if UTFException
is not the start of a
valid UTF-8 sequence.
str
[index
]
Notes
will only analyze the first stride
element. It
will not fully verify the validity of UTF-8 sequence, nor even verify
the presence of the sequence: it will not actually guarantee that
str
[index
]
.
index
+ stride
(str
, index
) <= str.length
Authors
Walter Bright and Jonathan M Davis