| 1234567891011121314151617181920212223242526 |
- package main
- import (
- "fmt"
- "strconv"
- "strings"
- )
- func main() {
- sText := "李志刚"
- textQuoted := strconv.QuoteToASCII(sText)
- textUnquoted := textQuoted[1 : len(textQuoted)-1]
- fmt.Println(textUnquoted)
- sUnicodev := strings.Split(textUnquoted, "\\u")
- var context string
- for _, v := range sUnicodev {
- if len(v) < 1 {
- continue
- }
- temp, err := strconv.ParseInt(v, 16, 32)
- if err != nil {
- panic(err)
- }
- context += fmt.Sprintf("%c", temp)
- }
- fmt.Println(context)
- }
|