String case: Difference between revisions
Content added Content deleted
(→{{header|Lua}}: add short form and Unicode limitation) |
(→{{header|Go}}: highlight bad handling of some Unicode characters) |
||
Line 1,751: | Line 1,751: | ||
strings.Map(unicode.SimpleFold, s)) |
strings.Map(unicode.SimpleFold, s)) |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Output: |
|||
{{out}} |
|||
<pre> |
<pre> |
||
string: alphaBETA len: 9 runes |
string: alphaBETA len: 9 runes |
||
Line 1,780: | Line 1,782: | ||
Title words: O'Hare O'HARE O’hare Don'T |
Title words: O'Hare O'HARE O’hare Don'T |
||
Swapping case: O'HARE o'hare O’HARE DON'T |
Swapping case: O'HARE o'hare O’HARE DON'T |
||
</pre> |
|||
Go handle many Unicode characters upcasing well but fails for some like [https://en.wikipedia.org/wiki/%C3%9F ß] where it hasn't changed <code>ß</code> into <code>SS</code> (expected <code>STROSSBÙRRI</code>) |
|||
<syntaxhighlight lang="go"> |
|||
package main |
|||
import ( |
|||
"fmt" |
|||
"strings" |
|||
) |
|||
func main() { |
|||
a := "Stroßbùrri" |
|||
b := "ĥåçýджк" |
|||
fmt.Println(strings.ToUpper(a)) |
|||
fmt.Println(strings.ToUpper(b)) |
|||
} |
|||
}</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
STROßBÙRRI |
|||
ĤÅÇÝДЖК |
|||
</pre> |
</pre> |
||