strFind Function [AX 2012]

Updated: November 24, 2009

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Searches a string for the first occurrence of one of the specified characters.

int strFind(
    str _text, 
    str _characters, 
    int _position, 
    int _number)




The string to search.


The characters for which to search.


The position in the string where the search begins.


A signed number that indicates the direction of the search and how many positions to search in the string.

The value of the position of the first occurrence of one of the specified characters.

To search from the beginning of the string to the end, use 1 as the value of the _position parameter.

If the value of the _number is negative, the system searches the number of characters backward from the specified position.

The search is not case-sensitive. For example:

  • strFind(“abcdef”, “D”, 3, 02) //Returns 4.

  • strFind(“abcdef”, “Bf”, 3, -2) //Returns 2.

  • strFind(“abcdef”, “Z”, 3, 2) //Returns 0.

  • strFind("ABCDEFGHIJ","KHD",1,10); //Returns the value 4 (the position where "D" was found).

  • strFind("ABCDEFGHIJ","KHD",10,-10); //Returns the value 8 (the position where "H" was found).

The strFind function is complementary to the strNFind function.

Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions