locate

Looks for a string within another string

Syntax

locate(match_string_expr,search_string_expr,startpos_num)

Arguments

match_string_expr The string for which a match is to be checked within search_string_expr.
search_string_expr The string to be searched.
startpos_num The character position at which a match of search_string_expr in match_string_expr begins. The first character is at position 1, not 0.

Description

This scalar string function retrieves the character position in one string (search_string_expr) where another string (match_string_expr) begins. The search begins at character position num. The locate function returns a 0 if it does not find match_string_expr. The string parameters can be ASCII or Unicode strings. If one of them is Unicode, the other one is implicitly converted into Unicode.