The LoadRunner Blog

Saturday, March 10, 2007

Replace x Character in your parameter with 'y'

A code snippet from ptrussell on sqaforums here

http://www.sqaforums.com/showthreaded.php?Cat=0&Number=362879&page=0&vc=1

Tells you how to replace some character in your parameter with another - in this case, replace a "+" with a " "

{
char *tmpstr;
int i;

tmpstr = lr_eval_string("{Map_Page_Street_Correlation}");

for (i = 0; tmpstr[i]; i++)
if (tmpstr[i] == '+') tmpstr[i] = ' ';
lr_save_string(tmpstr, "New_Street");
}
Jacqui posted another solution below

I thought I would throw this solution out there for general info. LR has a built in function to handle this. Here is an example....

web_convert_param("ParamName", "SourceString={Map_Page_Street_Correlation}","SourceEncoding=URL", "TargetEncoding=PLAIN", LAST);


Have a great weekend!
Jacqui

Labels: , , ,

0 Comments:

Post a Comment

<< Home