Added a nothrow function to convert dstring to string.
This commit is contained in:
parent
ba5d5bb3da
commit
f6457f2321
|
@ -1654,3 +1654,14 @@ final class Scanner
|
|||
return '\0';
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// A nothrow function that converts a dstring to a string.
|
||||
string utf32To8(dstring str) @safe pure nothrow
|
||||
{
|
||||
try { return str.to!string; }
|
||||
catch(ConvException e) { assert(false, "Unexpected invalid UTF-32 string"); }
|
||||
catch(Exception e) { assert(false, "Unexpected exception during UTF-8 encoding"); }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue