Altova MapForce 2025 Professional Edition

Returns the position of the first occurrence of substr within string. By default, the function starts the search from the first character, which has position (index) 1, but you can optionally specify a specific starting index. If substr cannot be found, then the function returns 0.

mf-func-find-substring

 

Languages

Built-in, C++, C#, Java.

 

Parameters

Name

Type

Description

string

xs:string

The input string.

substr

xs:string

The sub-string to search for.

startindex

xs:int

Optional. Specifies the starting position (index) of the search. If this parameter is not specified, the search starts at position 1.

 

Example

The following mapping outputs 3, which is the position of the first occurrence of the pipe character in the input string id|name|email.

mf-func-find-substring-example

If you specify 4 as starting index, then the function starts searching from the fourth character. Consequently, the mapping below outputs 8, which is the first occurrence of the pipe character after searching from the fourth character onwards.

mf-func-find-substring-example2

© 2018-2024 Altova GmbH