Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > INDEX_UTF8

Purpose

Find the UTF-8 character position of one string inside another where either may contain UTF-8 characters.

Syntax

#PositionOrError  = INDEX_UTF8(SearchInString, FindString)
 

Operation

Returns minus one if either string contains invalid UTF-8. Zero if the second argument could not be found in the first. Otherwise the UTF-8 character position of the second argument in the first. The first argument is the string expression to search in. The second argument is the string expression to find.

Remarks

This function works to UTF-8 character position and so can be used with SUBSTR_UTF8.

Example

#Position = INDEX_UTF8($Address, $HouseNumber + ' ' + $Street)

if #Position < 0 then

   umsg("INDEX_UTF8 failed - invalid UTF-8?", -1)

else

   if #Position = 0 then

      umsg("Failed to find house number and street in address", -1)

   else

      umsg("House number and address start at " + CONV(#Position),-1)

   endif

endif

Comment on this topic

Topic ID: 520330