isValid

Returns true if the string is encoded correctly

Supersedes: This function supersedes std.utf.validate(), however note that this function returns a bool indicating whether the input was valid or not, whereas the older function would throw an exception.

bool
isValid
(
E
)
(
const(E)[] s
)

Parameters

s const(E)[]

the string to be tested

Examples

assert( isValid("\u20AC100"));
assert(!isValid(cast(char[3])[167, 133, 175]));

Meta

Standards

Unicode 5.0, ASCII, ISO-8859-1, ISO-8859-2, WINDOWS-1250, WINDOWS-1251, WINDOWS-1252