Skip to content

Instantly share code, notes, and snippets.

@alexniver
Created November 12, 2018 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexniver/d42e7e346f3075c34fc18a2385d911a9 to your computer and use it in GitHub Desktop.
Save alexniver/d42e7e346f3075c34fc18a2385d911a9 to your computer and use it in GitHub Desktop.
生成范围内unicode的中文
package main

import (
    "fmt"
    "strconv"
)

func main() {
    startUnicodeStr := "4E00"
    endUnicodeStr := "9FA5"

    startUnicodeInt, _ := strconv.ParseInt(startUnicodeStr, 16, 64)
    endUnicodeInt, _ := strconv.ParseInt(endUnicodeStr, 16, 64)

    for code := startUnicodeInt; code <=endUnicodeInt; code ++ {
        code ++
        str,_ := strconv.Unquote(fmt.Sprintf("%s%s%s%s", "\"", "\\u", strconv.FormatInt(code, 16), "\""))
        fmt.Print(str)
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment