Project

General

Profile

« Previous | Next » 

Revision 14354

schemas/util.sql: added case-sensitive-optional versions of starts_with(), ends_with()

View differences:

trunk/schemas/util.sql
2535 2535

  
2536 2536

  
2537 2537
--
2538
-- Name: ends_with(text, text, boolean); Type: FUNCTION; Schema: util; Owner: -
2539
--
2540

  
2541
CREATE FUNCTION ends_with(suffix text, str text, case_sensitive boolean) RETURNS boolean
2542
    LANGUAGE sql IMMUTABLE
2543
    AS $$
2544
SELECT util.ends_with(util.canon_case(suffix, case_sensitive),
2545
util.canon_case(str, case_sensitive))
2546
$$;
2547

  
2548

  
2549
--
2538 2550
-- Name: ensure_prefix(text, text); Type: FUNCTION; Schema: util; Owner: -
2539 2551
--
2540 2552

  
......
5535 5547

  
5536 5548

  
5537 5549
--
5550
-- Name: starts_with(text, text, boolean); Type: FUNCTION; Schema: util; Owner: -
5551
--
5552

  
5553
CREATE FUNCTION starts_with(prefix text, str text, case_sensitive boolean) RETURNS boolean
5554
    LANGUAGE sql IMMUTABLE
5555
    AS $$
5556
SELECT util.starts_with(util.canon_case(prefix, case_sensitive),
5557
util.canon_case(str, case_sensitive))
5558
$$;
5559

  
5560

  
5561
--
5538 5562
-- Name: str_equality_regexp(text); Type: FUNCTION; Schema: util; Owner: -
5539 5563
--
5540 5564

  

Also available in: Unified diff