Splitting a string with the Strtok function

Source: Internet
Author: User
Tags strtok

Splitting a string with the Strtok function

You need to get "15" (the red highlighted below) in the LoadRunner and make the correlation parameter.

Body Response content: <BODY><; pre>//ok[8,7,5,15,6,5,0,4,0,3,0,3,2,0,0,0,1

Use Web_reg_save_param take Out "8,7,5,15,6,5,0,4,0,3,0,3,2,0,0,0,1" this paragraph, and then use Strtok function to cut out a number, the fourth number is to find the value

For example:

extern char * strtok (char * string, const char * delimiters); EXPLICIT Declaration

Char separators[] = ",";

char * token;

Lr_save_string ("1,2,3,4,5,6", "str");

token = (char *) strtok (lr_eval_string ("{str}"), separators); Get the first token

if (!token) {

Lr_output_message ("No tokens found in string!");

Return (-1);

}

while (token! = NULL) {//While valid tokens is returned

Lr_output_message ("%s", token);

token = (char *) strtok (NULL, separators); Get the next token

}

Splitting a string with the Strtok function requires a "15" (the red highlighted part below) in the LoadRunner, and is made into an associative parameter. Body Response content: <BODY><; pre>//ok[8,7,5,15,6,5,0,4,0,3,0,3,2,0,0,0,1 use Web_reg_save_param to take out "8,7,5,15,6,5,0,4,0,3,0,3,2,0,0,0,1" this paragraph, Then use the Strtok function to cut out a number, the fourth number is the value to find for example: extern char * strtok (char * string, const char * delimiters); Explicit Declaration char separators[] = ","; char * token; Lr_save_string ("1,2,3,4,5,6", "str"), token = (char *) strtok (lr_eval_string ("{str}"), separators); Get the first token if (!token) {         lr_output_message ("No tokens found in string!");         Return (-1);     } while (token! = NULL) {//While valid tokens         is returned Lr_output_message ("%s", token);         token = (char *) strtok (NULL, separators); Get the next token     }

Splitting a string with the Strtok function

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.