starts-with function

The fn:starts-with function determines whether a string begins with a specific substring. The search string is matched using the default collation.

Syntax

Read syntax diagramSkip visual syntax diagramfn:starts-with( string, substring)
string
The string to search for substring.

string has the xs:string data type, or is the empty sequence. If string is the empty sequence, string is set to a string of length 0.

substring
The substring to search for at the beginning of string.

substring has the xs:string data type, or is the empty sequence.

Limitation of length

The length of substring is limited to 32000 bytes.

Returned value

The returned value is the xs:boolean value true if either of the following conditions are satisfied:
  • substring occurs at the beginning of the string.
  • substring is an empty sequence of a string of length zero.
Otherwise, the returned value is false.

Example

The following function determines whether the string 'Test literal' begins with the string 'lite'.
fn:starts-with('Test literal','lite')

The returned value is false.