Split string with split_part in Asian language

徘徊边缘 提交于 2019-12-24 11:37:16

问题


I have a column with Asian addresses. I want to extract the substring until the first whitespace. However, this does not work here. My suspicion is that it has to do with the Asian language, but I do not why nor how to deal with this issue.

That's the code:

select address, split_part(address, ' ', 1) from asian

Exemplary output (no splitting has happened!). As you can see there are spaces.

address
"千葉県富津市新富20−1 新日本製鐵株式会社 技術開発本部内"
split_part
"千葉県富津市新富20−1 新日本製鐵株式会社 技術開発本部内"

回答1:


you can hack ideographic space with chr(), eg:

t=# select split_part('千葉県富津市新富20−1 新日本製鐵株式会社 技術開発本部内',chr(12288),1);
       split_part
-------------------------
 千葉県富津市新富20−1
(1 row)

t=# select split_part('千葉県富津市新富20−1 新日本製鐵株式会社 技術開発本部内',chr(12288),2);
     split_part
--------------------
 新日本製鐵株式会社
(1 row)


来源:https://stackoverflow.com/questions/47637493/split-string-with-split-part-in-asian-language

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!