String manipulation functions commonly used in LoadRunner

Source: Internet
Author: User

The string manipulation functions commonly used in LoadRunner are:

strcpy (destination_string, source_string);

strcat (string_that_gets_appended, string_that_is_appended); 51Testing Software Test Network: j3~c:c[(wr%a2l

Atoi (String_to_convert_to_int); Returns the integer value

Itoa (integer_to_conver_to_string, destination_string, base); Base is 10

strcmp (string1, string2);//returns 0 if both strings is equal51Testing software test network Q%usek

The definition of each function:

strcpy (): Copies a string into another string.

Strcat (): Adds a string to the end of another string.

strcmp (): Compares two strings, if equal returns 0.

Atoi (): Converts an ASCII string to an integral type.

itoa (): Converts an integer data to an ASCII string 51Testing software test network based on the given input d&vi2kd|

The following example uses the above functions:     

Actions () {Charmystring1[ -] =""; Charmystring2[ -] =""; Charmystring3[ -] ="Mercury2"; Charcstring[Ten] ="12345"; intCint; //MyString1 is empty//Lr_output_message (">>>>>>>>>> MyString1 =%s", MyString1); //copy "Mercury1" into MyString1//strcpy (MyString1,"Mercury1"); //Now MyString1 contains "Mercury1"//Lr_output_message (">>>>>>>>>> MyString1 =%s", MyString1); //Copy MyString3 into MyString2//Lr_output_message (">>>>>>>>>> MyString2 =%s", MyString2);       strcpy (MYSTRING2,MYSTRING3); Lr_output_message (">>>>>>>>>> MyString2 =%s", MyString2); //Catenate MyString2 to MyString1//strcat (MYSTRING1,MYSTRING2); Lr_output_message (">>>>>>>>>> MyString1 =%s", MyString1); //Cstring is converted to integer Cint//Lr_output_message (">>>>>>>>>> Cstring =%s", Cstring); Cint=atoi (Cstring); Lr_output_message (">>>>>>>>>> Cint =%d", Cint); //Cint is converted to stringCint= -; Itoa (cint,cstring,Ten); Lr_output_message (">>>>>>>>>> Cstring =%s", Cstring); return 0;}

String manipulation functions commonly used in LoadRunner

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.