String case: Difference between revisions
Content deleted Content added
→{{header|Lua}}: add short form and Unicode limitation |
→{{header|Go}}: highlight bad handling of some Unicode characters |
||
Line 1,751:
strings.Map(unicode.SimpleFold, s))
}</syntaxhighlight>
{{out}}
<pre>
string: alphaBETA len: 9 runes
Line 1,780 ⟶ 1,782:
Title words: 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>
|