starts-with

Se uma string começa com outra

Descrição

A função fn:starts-with devolve um xs:boolean que diz se uma string ($arg1) começa com os caracteres de outra ($arg2). Os espaços no início e no fim contam, então pode valer a pena usar fn:normalize-space para aparar as strings antes.

Parâmetros

Descrição

arg1:string()

a string inteira a testar

arg2:string()

o trecho a procurar

collation:string()

a collation usada para comparar

Exemplos

XPath

Resultado

starts-with('query', 'que')

true

starts-with('query', 'query')

true

starts-with('query', 'u')

false

starts-with('query', '')

true

starts-with('', 'query')

false

starts-with('', '')

true

starts-with('query', ())

true

starts-with(' query', 'q')

false

Veja também