AX Consulting

Just another WordPress.com site

Dynamics AX: strScan Function

Searches a text string for an occurrence of another string.

int strScan(   str _text1,    str _text2,    int _position,    int _number)
if (!MTPS) var MTPS = {};if (!MTPS.LocalizedStrings) MTPS.LocalizedStrings = {}; MTPS.LocalizedStrings.ExpandButtonTooltip = ‘Expand’; MTPS.LocalizedStrings.CollapseButtonTooltip = ‘Collapse’;

Parameters


Parameter

Description

_text1

The string in which to search.

_text2

The string to find.

_position

The first position in the _text1 parameter to perform a comparison.

_number

The number of positions in the _text1 parameter for which to retry the comparison.

If there is a minus sign in front of the _number parameter, the system searches the number of characters in reverse order from the specified position.

Return Value


The position in the string at which the specified string was found; otherwise, 0.

Remarks

The comparisons are not case sensitive.

Values for the _position parameter that are less than 1 are treated as 1.

The direction of the scan is controlled by the sign specified in the _number parameter. A positive sign indicates that each successive comparison will start one position closer to the end of the string. A negative sign indicates that each comparison will start one position closer to the start of the string.

  • strScan(“ABCDEFGHIJ”,”DEF”,1,10); //Returns the value 4.

  • strScan (“ABCDEFGHIJ”,”CDE”,10,-10); //Returns the value 3.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: