Re: i have a problem with judge some words contain chinese word!
От | Michael Glaesemann |
---|---|
Тема | Re: i have a problem with judge some words contain chinese word! |
Дата | |
Msg-id | 291BF5D7-D3FD-4F9D-9577-A6E433870EC4@seespotcode.net обсуждение исходный текст |
Ответ на | i have a problem with judge some words contain chinese word! (shiguoying <shiguoying@yeah.net>) |
Список | pgsql-general |
On Mar 30, 2009, at 10:14 , shiguoying wrote: > > Hello: > I have a problem with juding some words contain chinese word. > > I found that with oracle.but i can't find it in postgresql. > oracle? has acsiistr and lengthb to deal with it.i wonna to know > postgresql how to ! > ??? thx ! > from > eagle You can use regexp_replace to remove sets of charcters and then compare lengths or even the strings themselves: SELECT some_text, LENGTH(some_text), re, LENGTH(re), some_text = re as str_eq, LENGTH(some_text) = LENGTH(re) AS len_eq FROM (SELECT some_text, regexp_replace(some_text, $re$[^[:ascii:]] $re$, '', 'g') as re FROM (VALUES ('foo'), ('foo bar baz'), ('foo.bar,baz'), ('foo 案')) AS samples(some_text)) AS s; some_text | length | re | length | str_eq | len_eq -------------+--------+-------------+--------+--------+-------- foo | 3 | foo | 3 | t | t foo bar baz | 11 | foo bar baz | 11 | t | t foo.bar,baz | 11 | foo.bar,baz | 11 | t | t foo案 | 4 | foo | 3 | f | f (4 rows) Michael Glaesemann grzm seespotcode net
В списке pgsql-general по дате отправления: