egdb3_11_7
.metabib
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
trim_trailing_punctuation(text)
Parameters
Name
Type
Mode
text
IN
Definition
DECLARE result TEXT; last_char TEXT; BEGIN result := $1; last_char = substring(result from '.$'); IF last_char = ',' THEN result := substring(result from '^(.*),$'); ELSIF last_char = '.' THEN -- must have a single word-character following at least one non-word character IF substring(result from '\W\w\.$') IS NULL THEN result := substring(result from '^(.*)\.$'); END IF; ELSIF last_char IN ('/',':',';','=') THEN -- Dangling subtitle/SoR separator IF substring(result from ' .$') IS NOT NULL THEN -- must have a space before last_char result := substring(result from '^(.*) .$'); END IF; END IF; RETURN result; END;