Project

General

Profile

« Previous | Next » 

Revision 14188

schemas/util.sql: remove_prefix(), remove_suffix(): use new starts_with(), ends_with()

View differences:

trunk/schemas/util.sql
4168 4168
    AS $$
4169 4169
-- must be declared STRICT to handle NULL properly
4170 4170
SELECT CASE
4171
WHEN substring(str from 1 for length(prefix)) = prefix THEN
4171
WHEN util.starts_with(prefix, str) THEN
4172 4172
	substring(str from 1+length(prefix))
4173 4173
WHEN NOT require THEN str
4174 4174
ELSE
......
4187 4187
    AS $$
4188 4188
-- must be declared STRICT to handle NULL properly
4189 4189
SELECT CASE
4190
WHEN substring(str from 1+(length(str)-length(suffix))) = suffix THEN
4190
WHEN util.ends_with(suffix, str) THEN
4191 4191
	substring(str from 1 for length(str)-length(suffix))
4192 4192
WHEN NOT require THEN str
4193 4193
ELSE

Also available in: Unified diff