Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Unicode¶
In [1]:
len("尼")
Out[1]:
In [1]:
s := "在线中文输入"
In [2]:
s
Out[2]:
In [3]:
len(s)
Out[3]:
In [4]:
import "unicode/utf8"
In [5]:
q := "A to Z"
q
Out[5]:
In [7]:
fc, size1 := utf8.DecodeRuneInString(q)
In [8]:
fc
Out[8]:
In [9]:
size1
Out[9]:
In [10]:
lc, size2 := utf8.DecodeLastRuneInString(q)
In [11]:
lc
Out[11]:
In [12]:
size2
Out[12]:
In [14]:
fc, size1 := utf8.DecodeRuneInString(s)
In [15]:
fc
Out[15]:
In [16]:
size1
Out[16]:
In [ ]: