Added a nothrow function to convert dstring to string.

This commit is contained in:
Ferdinand Majerech 2014-07-23 18:18:21 +02:00
parent ba5d5bb3da
commit f6457f2321

View file

@ -1654,3 +1654,14 @@ final class Scanner
return '\0'; 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"); }
}