View source code
Display the source code in std/utf.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
std.utf.encode
- multiple declarations
- Function encode
- Function encode
Function encode
Encodes
into the static array, c
, and returns the actual
length of the encoded character (a number between buf
1
and 4
for
char[4]
buffers and a number between 1
and 2
for
wchar[2]
buffers).
Prototypes
ulong encode( char[4] buf, dchar c ) pure @safe; ulong encode( wchar[2] buf, dchar c ) pure @safe;
Throws
if UTFException
is not a valid UTF code point.
c
Function encode
Encodes
in c
's encoding and appends it to str
.
str
Prototypes
void encode( char[] str, dchar c ) pure @safe; void encode( wchar[] str, dchar c ) pure @safe; void encode( dchar[] str, dchar c ) pure @safe;
Throws
if UTFException
is not a valid UTF code point.
c
Authors
Walter Bright and Jonathan M Davis