Thursday, April 23, 2015

Introduction & String Functions in AX 2012

Hi Daxer's !!!
I'm very glad to explore my knowledge on Microsoft Dynamics Ax .

-- "Gaining knowledge is the first step to wisdom,

          Sharing knowledge is first step to Humanity !!!


 String Functions in AX 2012   

1.strAlpha Function:

Copies only the alphanumeric characters from a string.
Syntax:
str strAlpha(str _text)
Example:
info(strAlpha("Shiva89^&"));
Op:shiva89

2.strCmp Function :

Compares two text strings.

Note: 0 if the two strings are identical, 1 if the first string sorts earlier, or -1 if the second string sorts earlier.

Syntax:
int strCmp(str text1, str text2)

The comparison performed by this method is case-sensitive.

Example:

print strCmp("shiva","shiva");
        pause;

Op:  returns 0 if two strings are identical

print strCmp("shiva","SHI");
        pause;

Op:  returns 1 if first string is executed first;

print strCmp("sss","ggg");
        pause;

Op: returns 1 if the second string executed first;

print strCmp("hhh","ooo");

        pause;
Op: returns -1 if the second string executed first;

3.strColSeq Function:

Converts all uppercase characters to lowercase characters and also converts all special  design characters like (ÁÎ to ai) to lowercase characters

Syntax:

str strColSeq(str text)

Example:

info(strColSeq("AbçDËãBCdé"));

Op:abcdeabcde

 4.strDel Function:

Creates a copy of a string with the specified substring removed.

Syntax:

str strDel(

    str _text,
    int _position,
    int _number)
 
Example:

using strDel function Note: removes 2 letters from 4th letter onwards

info(strDel("ShivaKumar",4,2));
 
Op:ShiKumar
 
info(strDel("ShivaKumar",4,-3));

Op: SaKumar

Parameters

Parameter
Description
_text
The string to copy from
_position
The position at which to begin ignoring characters during the copy.
_number
The number of characters to ignore.
A minus sign in front of the _number parameter indicates that the (_number-1) characters before the character at the_position parameter are to be removed along with the character at the _position.

 

5.strFind Function:

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

Syntax:

int strFind(
    str _text, 
    str _characters, 
    int _position, 
    int _number)
Parameter
Description
_text
The string to search.
_characters
The characters for which to search.
_position
The position in the string where the search begins.
_number
A signed number that indicates the direction of the search and how many positions to search in the string.

 Example:

print strFind("shivaKumar","v",1,10);
    pause;

OP: returns 4

print strFind("shivaKumar","i",6,-4);
    pause;

OP: returns 3

Note: returns 4 and 3 according to the position of given value;

6.strFmt Function:

Formats the specified string and substitutes any occurrences of % n with the nth argument.

Syntax:
str strFmt(str _string, ...)

Example:

static void Shiv_StringsFunction(Args _args)

    {
    str Ax= 'Axapta';
    str W ='World';
    ;
  
     {
       info(strFmt(" Welcome to %1,%2",Ax,w));
   
       }
}

Op: Welcome to Axapta,World

7.strIns Function:

Builds a string by inserting one string into another.

Syntax: str strIns(str _text1, str _text2, int _position)

 Example:

static void Shiv_StringsFunction(Args _args)

{

info(strIns("shKumar","iva",3));// Note:Inserting string  from 3rd letter onwards


}
Op:shivakumar

8.strKeep Function:

Builds a string from only the characters in the first input string that are specified to be kept by the second string.

Or

Shows only specifield value of string

Syntax: str strKeep(str _text1, str _text2)

Example:

info(strKeep("shivaKumar","vaK"));

Op: VaKa

9.strLen Function

Calculates the length of the specified string.

Syntax: int strLen(str text)
Example:
print strLen("shiva");
    pause;
Op:5

10.strLine Function:

Retrieves a single line from a string that spans multiple lines.

Syntax:

str strLine(str string, int count)

Example:

str Ax="Hello\nDaxers\r\n@India\n@dhanush";

    {
        info(strLine(Ax,0));
        info(strLine(Ax,1));
        info(strLine(Ax,2));
       
    }
Op:
Hello

Daxers

@ India

11.strLTrim Function:

Removes leading blanks from a text string. Or removes  left side space of the string

Syntax:

str strLTrim(str text)

Example:

info(strLTrim("   Shiva   "));// op:Shiva

12.strRTrim Function :

Removes the trailing space characters from the end of a string. Or removes right side space of the string value
Syntax: str strRTrim(str _text)
Example:
info(strRTrim("   Shiva   "));// op:   Shiva

13.strLwr Function:

Converts all letters in the specified string to lowercase.

Syntax:

str strLwr(str _text)

Example: info(strLwr("SHiVa")); Op: shiva

14.strNFind Function:

Searches a portion of a text string for the first occurrence of a character that is not included in the specified list of characters.

Syntax:

int strNFind(
    str _text,
    str _characters,
    int _position,
    int _number)
Example:
print strNFind("shiva","shva",1,5); //op: returns 3(position of i)
    pause;
print strNFind("shiva","shIva",1,5); //op: returns 0(position of i)
    pause;

15.strPoke Function:

Overwrites part of a string with another string.

Syntax:
str strPoke(
    str _text1,
    str _text2,
    int _position)

 Example:

info(strPoke("shiva","kumar",4)); //op:shivkumar

16.strPrompt Function:

Appends to a string the specified number of period characters followed by a colon and space character.

Syntax:

str strPrompt(str _string, _int len)
Example:
print strPrompt("Shi",-1); //Returns "Shi ".
print strPrompt("Shi",3); //Returns "Shi ".
print strPrompt("Shi",4); //Returns "Shi: ".
print strPrompt("Shi",5); //Returns "Shi.: ".
print strPrompt("Shi",6); //Returns "Shi..: ".
    pause;
 

 

17.strRem Function:

Removes the characters specified in one string from another string.

Or

Removes the specified value of a string

Syntax: 
str strRem(str text1, str text2)

 Example:

io(strRem(nf"shiva","va")); //op:shi

18.strRep Function:

Repeats a string of characters.
Syntax:
str strRep(str _text, str _number)
 
Example:
info(strRep("shiva",5)); //Op:shivashivashivashivashiva
   

19.strScan Function:

Searches a text string for an occurrence of another string.

Syntax:

int strScan(
    str _text1,
    str _text2,
    int _position,
    int _number)
Example:
print strScan("shivaKumar","h",9,-10);//op:2
    pause;
 
print strScan("shivaKumar","iva",1,10);//op:3
    pause;

20.strUpr Function:

Converts all the letters in a string to uppercase.Syntax:
str strUpr(str _text)

 Example:

info(strUpr("SHiva"));// op:SHIVA

21.subStr Function:

Retrieves part of a string. Or retrieves we required value a part from the string
Syntax: str subStr(str _text, int _position, int _number)
Example:
info(subStr("ShivaKumar",3,6));//op:vakum
Note:Retrives String value from 3rd value  onwards up to 6th letter
info(subStr("ShivaKumar",6,-4));
Note: Retrives String value from 6th value  towards  to 4th letter

22.match Function:

Searches for a string or expression within another string.
Syntax:
int match(str pattern, str text)

Example: print match("<shi","shivakumar");//op: returns 1

pause;

print match("^shi","shivakumar");");//op: returns 1
pause;

 

 Keep Daxing !!!

HaPpYyY  Daxing :)

 


 

 

 

 

 


 

 


 
 

 


 

 

 

 

 







2 comments:

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...