<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: String Manipulation in LoadRunner</title>
	<atom:link href="http://www.myloadtest.com/string-manipulation-in-loadrunner/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/</link>
	<description>Performance Testing with a LoadRunner focus</description>
	<lastBuildDate>Sat, 13 Mar 2010 03:31:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Pallavi</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-17639</link>
		<dc:creator>Pallavi</dc:creator>
		<pubDate>Tue, 20 May 2008 06:07:01 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-17639</guid>
		<description>Hi,
I am using for loop to repeat first transaction &amp; after completing for loop, second transaction should start. The script work well without parameterization on one variable, but when the parameterization is used, the for loop is using same (first value) value for the entire loop. My aim is to use the sequential value of the parameter from the file. How to achieve this?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am using for loop to repeat first transaction &amp; after completing for loop, second transaction should start. The script work well without parameterization on one variable, but when the parameterization is used, the for loop is using same (first value) value for the entire loop. My aim is to use the sequential value of the parameter from the file. How to achieve this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Linden</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-13338</link>
		<dc:creator>Linden</dc:creator>
		<pubDate>Fri, 30 Nov 2007 03:18:58 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-13338</guid>
		<description>Worth noting that SaveLen and SaveOffset Attributes for web_reg_save_param can be used to effectively pull substrings into variables which can later be concatenated to suit formatting requirements.</description>
		<content:encoded><![CDATA[<p>Worth noting that SaveLen and SaveOffset Attributes for web_reg_save_param can be used to effectively pull substrings into variables which can later be concatenated to suit formatting requirements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Linden</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-13332</link>
		<dc:creator>Linden</dc:creator>
		<pubDate>Fri, 30 Nov 2007 01:49:56 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-13332</guid>
		<description>I believe your output string length can be 1 char larger than necessary. As the first set of 3 digits (when reading left to right) will never require a comma in front of it.

For a string with 20 characters, 6 commas are necessary and (strlen(input)/3) = 20/3 = 6 is correct. However, for a string with 21 values, 6 commas are necessary (still) yet (strlen(input)/3) = 21/3 = 7 is incorrect. So here&#039;s a nasty way of fixing that:

int fix=0;
if(strlen(input)%3==0) fix=1;
// should be 4 + strlen(input) + (strlen(input)/3) - fix</description>
		<content:encoded><![CDATA[<p>I believe your output string length can be 1 char larger than necessary. As the first set of 3 digits (when reading left to right) will never require a comma in front of it.</p>
<p>For a string with 20 characters, 6 commas are necessary and (strlen(input)/3) = 20/3 = 6 is correct. However, for a string with 21 values, 6 commas are necessary (still) yet (strlen(input)/3) = 21/3 = 7 is incorrect. So here&#8217;s a nasty way of fixing that:</p>
<p>int fix=0;<br />
if(strlen(input)%3==0) fix=1;<br />
// should be 4 + strlen(input) + (strlen(input)/3) &#8211; fix</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angel</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-5142</link>
		<dc:creator>Angel</dc:creator>
		<pubDate>Fri, 13 Apr 2007 10:25:02 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-5142</guid>
		<description>How I can extract text from the last HTTP response received by the virtual user and later to manipulate the string in the script of Loadrunner</description>
		<content:encoded><![CDATA[<p>How I can extract text from the last HTTP response received by the virtual user and later to manipulate the string in the script of Loadrunner</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-221</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Tue, 07 Mar 2006 07:53:02 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-221</guid>
		<description>thanks Stuart ...its working</description>
		<content:encoded><![CDATA[<p>thanks Stuart &#8230;its working</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Moncrieff</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-220</link>
		<dc:creator>Stuart Moncrieff</dc:creator>
		<pubDate>Tue, 07 Mar 2006 07:30:18 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-220</guid>
		<description>The code got mangled by the content managment system (must have happened in the last upgrade).

I have corrected all the errors that were introduced. Give it another go.

Cheers,
Stuart.</description>
		<content:encoded><![CDATA[<p>The code got mangled by the content managment system (must have happened in the last upgrade).</p>
<p>I have corrected all the errors that were introduced. Give it another go.</p>
<p>Cheers,<br />
Stuart.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-218</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Mon, 06 Mar 2006 13:01:00 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-218</guid>
		<description>for (i=0;i if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ){

I used this loop as given in the above page. LR is throwing errors. please find the Error.

ction.c (7): syntax error; found `if&#039; expecting `;&#039;
Action.c (7): syntax error; found `if&#039; expecting `)&#039;
Action.c (12): warning: missing return value
Action.c (13): expecting an identifier
Action.c (13): syntax error; found &quot;.00&quot; expecting `)&#039;
Action.c (13): skipping &quot;.00&quot;
Action.c (13): extraneous old-style parameter list
Action.c (14): unrecognized declaration
Action.c (15): unrecognized declaration



LPCSTR ConvertStringToDollars(char input[20]) 
		{
		    int i;
    		char output[30];
    		strcpy(output, &quot;$&quot;);
		 	for (i=0;i if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ){
			//for (i=0; i=if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ) {
            output[strlen(output)]=&#039;,&#039;;
        }
        output[strlen(output)] = input[i];
    }
   strcat(output,&quot;.00&quot;);
    return output;
}

Action()
{
    lr_output_message(ConvertStringToDollars(&quot;123456&quot;)); // Prints &quot;$123,456.00&quot;
    return 0;
}</description>
		<content:encoded><![CDATA[<p>for (i=0;i if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ){</p>
<p>I used this loop as given in the above page. LR is throwing errors. please find the Error.</p>
<p>ction.c (7): syntax error; found `if&#8217; expecting `;&#8217;<br />
Action.c (7): syntax error; found `if&#8217; expecting `)&#8217;<br />
Action.c (12): warning: missing return value<br />
Action.c (13): expecting an identifier<br />
Action.c (13): syntax error; found &#8220;.00&#8243; expecting `)&#8217;<br />
Action.c (13): skipping &#8220;.00&#8243;<br />
Action.c (13): extraneous old-style parameter list<br />
Action.c (14): unrecognized declaration<br />
Action.c (15): unrecognized declaration</p>
<p>LPCSTR ConvertStringToDollars(char input[20])<br />
		{<br />
		    int i;<br />
    		char output[30];<br />
    		strcpy(output, &#8220;$&#8221;);<br />
		 	for (i=0;i if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ){<br />
			//for (i=0; i=if ( ((strlen(input)-i)%3==0) &amp;&amp; (i!=0) ) {<br />
            output[strlen(output)]=&#8217;,';<br />
        }<br />
        output[strlen(output)] = input[i];<br />
    }<br />
   strcat(output,&#8221;.00&#8243;);<br />
    return output;<br />
}</p>
<p>Action()<br />
{<br />
    lr_output_message(ConvertStringToDollars(&#8220;123456&#8243;)); // Prints &#8220;$123,456.00&#8243;<br />
    return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Moncrieff</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-187</link>
		<dc:creator>Stuart Moncrieff</dc:creator>
		<pubDate>Wed, 19 Oct 2005 12:24:11 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-187</guid>
		<description>I&#039;ve said it before. Everyone who uses LoadRunner professionally should know C.

Joel Spolsky agrees with me. He says that all programmers should get &lt;a href=&quot;http://www.joelonsoftware.com/articles/fog0000000319.html&quot; rel=&quot;nofollow&quot;&gt;Back to Basics&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve said it before. Everyone who uses LoadRunner professionally should know C.</p>
<p>Joel Spolsky agrees with me. He says that all programmers should get <a href="http://www.joelonsoftware.com/articles/fog0000000319.html" rel="nofollow">Back to Basics</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Moncrieff</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-175</link>
		<dc:creator>Stuart Moncrieff</dc:creator>
		<pubDate>Sun, 31 Jul 2005 11:37:51 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-175</guid>
		<description>Another recent Mercury Support Forum question (and my answer) demonstrates my point also...

&lt;strong&gt;How to find the absolute value of a double ?&lt;/strong&gt;
Hi,

How to find the absolute value of a double variable ?

function &quot;abs()&quot; gives wrong result.

Thanks &amp; Regards

R.K 

&lt;strong&gt;How to find the absolute value of a double ?&lt;/strong&gt;
Your problem is that the standard C library funtion abs() is expecting its argument to be an int rather than a double. As C is a weakly typed language, the function just treats the double value as if it was an int even though the two data types are stored differently in memory. Consequently you get garbage as output.

&lt;!--
Either you can look for a free library on the Internet that does this for you, or you can do something simple like squaring the number then taking the square root.

Here is the code. Note that the sqrt function must be explicitly declared as it does not return an int.

double sqrt(double x); /* Explicit forward declaration */

Action()
{
  double d = -1.2;

  d = d*d;
  d = sqrt(d);
 
  lr_output_message(&quot;%g&quot;, d); // outputs &quot;1.2&quot;

  return 0;
}

--&gt;

Cheers,
Stuart.</description>
		<content:encoded><![CDATA[<p>Another recent Mercury Support Forum question (and my answer) demonstrates my point also&#8230;</p>
<p><strong>How to find the absolute value of a double ?</strong><br />
Hi,</p>
<p>How to find the absolute value of a double variable ?</p>
<p>function &#8220;abs()&#8221; gives wrong result.</p>
<p>Thanks &amp; Regards</p>
<p>R.K </p>
<p><strong>How to find the absolute value of a double ?</strong><br />
Your problem is that the standard C library funtion abs() is expecting its argument to be an int rather than a double. As C is a weakly typed language, the function just treats the double value as if it was an int even though the two data types are stored differently in memory. Consequently you get garbage as output.</p>
<p><!--<br />
Either you can look for a free library on the Internet that does this for you, or you can do something simple like squaring the number then taking the square root.</p>
<p>Here is the code. Note that the sqrt function must be explicitly declared as it does not return an int.</p>
<p>double sqrt(double x); /* Explicit forward declaration */</p>
<p>Action()<br />
{<br />
  double d = -1.2;</p>
<p>  d = d*d;<br />
  d = sqrt(d);</p>
<p>  lr_output_message("%g", d); // outputs "1.2"</p>
<p>  return 0;<br />
}</p>
<p>--></p>
<p>Cheers,<br />
Stuart.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.myloadtest.com/string-manipulation-in-loadrunner/#comment-40</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 19 Jun 2005 05:16:28 +0000</pubDate>
		<guid isPermaLink="false">/?p=48#comment-40</guid>
		<description>It&#039;s like some kind of brain teasing challenge...

&lt;em&gt;You have the following functions sprintf, strcat, strchr, strcmp, strcpy,
strdup, stricmp, strlen, strlwr, strncat, strncmp, strncpy, strnicmp,
strrchr, strset, strspn, strstr,  strtok, strupr, and as many native
language features as you like. Try not to leak or overwrite memory. Your time starts now...&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>It&#8217;s like some kind of brain teasing challenge&#8230;</p>
<p><em>You have the following functions sprintf, strcat, strchr, strcmp, strcpy,<br />
strdup, stricmp, strlen, strlwr, strncat, strncmp, strncpy, strnicmp,<br />
strrchr, strset, strspn, strstr,  strtok, strupr, and as many native<br />
language features as you like. Try not to leak or overwrite memory. Your time starts now&#8230;</em></p>
]]></content:encoded>
	</item>
</channel>
</rss>
