replaceing spaces with ”%20” in a parameter

  • Questions
  • replaceing spaces with ''%20'' in a parameter
Question ID: 104221
1
0

I am working on a script that has an address for an input. The address is setup as a parameter coming from a data file. Part of the request that is sent replaces all of the spaces in the address with %20. I’ve tried a few ways to do it but either it does not work or I get an memory access violation while looping through an array.

To give an example, if the address is : 101 W Main Street

The response would contain: 101%20W%20Main%20Street

… so I would need another address parameter with that format.

Parts of the script need the address as it appears in the parameter itself and other parts need the spaces removed. I will need to loop through several address when I run the script in a scenario.

I am using Vugen 9.52.

Thanks for the help,

Mark

Marked as spam
Posted by (Questions: 5, Answers: 1)
Asked on September 14, 2010 3:18 pm
20 views
Answers (1)
2
Private answer

Use the LoadRunner ''web_convert_param'' function.

It can convert from either HTML or PLAIN to PLAIN or URL.

You would be looking to do a conversion from PLAIN to URL:

web_convert_param(''dLRParam'', ''SourceEncoding=PLAIN'', ''TargetEncoding=URL'', LAST);

or:

web_convert_param(''dLRNewParam'', lr_eval_string(''SourceText={dOldParam}''), ''SourceEncoding=PLAIN'', ''TargetEncoding=URL'',LAST);

The first does an ''in place'' conversion, that is, the input text comes from ''dLRParam'' and is put back there. The second format creates ''dLRNewParam'' from ''dOldParam'')

Marked as spam
Posted by (Questions: 1, Answers: 5)
Answered on September 15, 2010 6:48 pm