Learning the C-language function of LoadRunner

Source: Internet
Author: User
Tags strcmp

Learn the difference between LoadRunner C function Action () {/*STRCHR and STRRCHR */* char *strtest1= "Citms Citms"; char *strtest2,*strtest3;// Find the character T in StrTest1, and start intercepting it when the first time you touch T. strtest2= (char *) STRCHR (strTest1, ' t ');  Lr_output_message ("The first occurrence of T:%s", strTest2); Find the character T in StrTest1, and start to intercept it when the first time you touch T. strtest3= (char *) STRRCHR (strTest1, ' t '); Lr_output_message ("The last occurrence of T:%s", STRTEST3); */This code results in: The first occurrence of T:tms Citms the last occurrence of T:tms/*strcpy and strncpy,memcpy the difference */* char * strtest1= "Citms Citms"; Char strtest4[50],strtest5[50]; Copy the contents of the StrTest1 into the strTest4. strcpy (STRTEST4,STRTEST1); Lr_output_message ("%s", STRTEST4); The contents of the StrTest1, from the beginning of the interception of 4 bits, copied into the StrTest5 inside. strncpy (strtest5,strtest1,4); Lr_output_message ("%s", STRTEST5); "StrTest4" in the string represents the end character, so the code below is ABC strcpy (STRTEST4, "abc\0abc");  Lr_output_message ("%s", STRTEST4); strncpy (STRTEST5, "Abc\0abc", 6); Lr_output_message ("%s", STRTEST5); Through the memcpy function, you can identify the character after "\", the result of the following code is//ABC//def memcpy (strTest5, "Abc\0def",7); Lr_output_message ("%s", STRTEST5); Lr_output_message ("%s", strtest5+4); * * */*strcmp and stricmp the difference */* char strtest6[50]= "How old is You?"; Char *strtest7; int result;  Strtest7= "How old is You?"; RESULT=STRCMP (STRTEST6,STRTEST7);  Lr_output_message ("%d", result); RESULT=STRICMP (STRTEST6,STRTEST7); Lr_output_message ("%d", result); Returns the number 1, the previous string is greater than the next//return number 0, for the previous string equals the next//return-1, for the previous string is less than the next//strcmp is a case-sensitive comparison, STRICMP is a case-insensitive comparison */* The difference between strcat and strncat */* char strtest8[50];  Char *strtest9= "is lilei.";  strcpy (StrTest8, "My name"); strcat (STRTEST8,STRTEST9);  Lr_output_message ("%s", STRTEST8); Strncat (strtest8,strtest9,5); Lr_output_message ("%s", STRTEST8); */* Char *stringtest= "ABC\0ABC"; int stringlength=0;    Lr_output_message ("%s", stringtest); Stringlength=strlen (stringtest); Lr_output_message ("%d", stringlength);  */return 0;}

if (Strstr (lr_eval_string ("{response}"), "OK")! = NULL)  {//pass}else{//fail}

Learning the C-language function of 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.