String case: Difference between revisions

→‎{{header|Pike}}: Added Unicode example
(Added Pike implementation)
(→‎{{header|Pike}}: Added Unicode example)
Line 1,976:
Silly: "Foo Bar Gazonk"
Elite: "fo() 8ar 6azo|\\||<"
</pre>
 
When dealing with Unicode (or any other supported encoding) care must
be taken primarily in the output step to serialize the Unicode string
into something the sink can handle. IO functions will throw an error
if sent raw wide strings.
 
<lang Pike>#charset utf8
void main()
{
string s = upper_case("ἀρχῇ ß");
string out = sprintf("Upper: %s\nLower: %s\n",
s, lower_case(s));
write( string_to_utf8(out) );
}</lang>
{{Out}}
<pre>
Upper: ἈΡΧῇ ß
Lower: ἀρχῇ ß
</pre>
 
Anonymous user