Guest User

Untitled

a guest
Feb 17th, 2014
226
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import "code.google.com/p/go.text/unicode/norm"
  4. import "fmt"
  5. import "unicode/utf8"
  6.  
  7. func main() {
  8.   s := "\u0451\u0439" // ёй
  9.   s_nfc := norm.NFC.String(s)
  10.   s_nfd := norm.NFD.String(s)
  11.   for _,x := range [...]string{s, s_nfc, s_nfd} {
  12.     fmt.Printf("'%s' (%x) has %d runes\n", x, x, utf8.RuneCountInString(x))
  13.   }
  14. }
  15.  
  16. // output:
  17. // $ go build gonorm && ./gonorm
  18. // 'ёй' (d191d0b9) has 2 runes
  19. // 'ёй' (d191d0b9) has 2 runes
  20. // 'ёй' (d0b5cc88d0b8cc86) has 4 runes
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×