It's a bug? first,last,rest in utf-8 string

For the Compleat Fan
Post Reply
qinying
Posts: 7
Joined: Sun Jul 16, 2017 11:12 am

It's a bug? first,last,rest in utf-8 string

Post by qinying »

> (set 'str "中文字符串")
"中文字符串"
> (first str)
"中"
> (last str) ;Should be "串"
"?
> (rest str)
"文字符串"
---------
> (set 'name "覃文运")
"覃文运"
> (first name) ;Should be "覃"
"覃文"
> (rest name) ;Should be "文运"
"运"
> (last name)
"运"

gekkonier
Posts: 14
Joined: Fri Jan 26, 2018 7:44 pm

Re: It's a bug? first,last,rest in utf-8 string

Post by gekkonier »

Hi qinying, are you sure?

Im running this with UTF-8 version inside atom with plugin script (on win10, with utf-8 newLISP)

Code: Select all

(set 'str "中文字符串")
(println str)
(println (first str))
(println (last str))
(println (rest str))
(println (explode str))
The output:

Code: Select all

中文字符串
中
串
文字符串
("中" "文" "字" "符" "串")
That seems to be correct to me, isn't it?

Post Reply