String functions: Tracker SPARQL Library Reference Manual

## String functions

### fn:lower-case

    	fn:lower-case (?string)

Converts a string to lowercase, equivalent to `LCASE`.

### fn:upper-case

    	fn:upper-case (?string)

Converts a string to uppercase, equivalent to `UCASE`.

### fn:contains

    	fn:contains (?haystack, ?needle)

Returns a boolean indicating whether `?needle` is found in `?haystack`. Equivalent to `CONTAINS`.

### fn:starts-with

    	fn:starts-with (?string, ?prefix)

Returns a boolean indicating whether `?string` starts with `?prefix`. Equivalent to `STRSTARTS`.

### fn:ends-with

    	fn:ends-with (?string, ?suffix)

Returns a boolean indicating whether `?string` ends with `?suffix`. Equivalent to `STRENDS`.

### fn:substring

    	fn:substring (?string, ?startLoc)
    	fn:substring (?string, ?startLoc, ?endLoc)

Returns a substring delimited by the integer `?startLoc` and `?endLoc` arguments. If `?endLoc` is omitted, the end of the string is used.

### fn:concat

    	fn:concat (?string1, ?string2, ..., ?stringN)

Takes a variable number of arguments and returns a string concatenation of all its returned values. Equivalent to `CONCAT`.

### fn:string-join

    	fn:string-join ((?string1, ?string2, ...), ?separator)

Takes a variable number of arguments and returns a string concatenation using `?separator` to join all elements.

### fn:replace

    	fn:replace (?string, ?regex, ?replacement)
    	fn:replace (?string, ?regex, ?replacement, ?flags)

Performs string replacement on `?string`. All matches of `?regex` are replaced by `?replacement` in the returned string. This function is similar to `REPLACE`

The `?flags` argument is optional, a case search is performed if not provided.

If `?flags` contains the character `“s”`, a dot metacharacter (".") in `?regex` matches all characters, including newlines. Without it, newlines are excluded.

If `?flags` contains the character `“m”`, the “start of line” (`^`) and “end of line” (`$`) constructs match immediately following or immediately before any newline in the string. If not set these constructs will respectively match the start and end of the full string.

If `?flags` contains the character `“i”`, search is caseless.

If `?flags` contains the character `“x”`, `?regex` is interpreted to be an extended regular expression.

### tracker:case-fold

    	tracker:case-fold (?string)

Converts a string into a form that is independent of case.

### tracker:title-order

    	tracker:title-order (?string)

Manipulates a string to remove leading articles for sorting purposes, e.g. “Wall, The”. Best used in `ORDER BY` clauses.

### tracker:ascii-lower-case

    	tracker:ascii-lower-case (?string)

Converts an ASCII string to lowercase, equivalent to `LCASE`.

### tracker:normalize

    	tracker:normalize (?string, ?option)

Normalizes `?string`. The `?option` string must be one of `nfc`, `nfd`, `nfkc` or `nfkd`.

### tracker:unaccent

    	tracker:unaccent (?string)

Removes accents from a string.

### tracker:coalesce

    	tracker:coalesce (?value1, ?value2, ..., ?valueN)

Picks the first non-null value. Equivalent to `COALESCE`.