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 新日本製鐵株式会社 技術開発本部内"
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)