subStr Function

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

Retrieves part of a string.

str subStr(str _text, int _position, int _number)





The original string.


The position in the original string where the part to retrieve begins.


A signed integer that indicates the direction and number of positions to retrieve from the original string.

If there is a minus sign preceding _number, the system selects the substring backward from the specified position.

Return Value

A substring of the original string.


If there is a minus sign before the value of the _number parameter, the substring will be selected backward from the specified position.

  • subStr("ABCDEFGHIJ",3,5); //Returns the string “CDEFG”.

  • subStr("ABCDEFGHIJ",7,-4); //Returns the string “DEFG”.

  • subStr("abcdef"),2,99) //Returns the string "cdef".

  • subStr("abcdef",2,3) //Returns the string "bcd".

  • subStr("abcdef",2,-3); //Returns the string "ab".

See also

strDel Function

strIns Function

strRem Function

strLTrim Function

strRTrim Function

strKeep Function

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