VUGen Code Snippet for stripping out new line characters

I should build a function library for VUGEN so I can reuse these everywhere I go, as I often find myself having to redo these. Anyhow this bit of code will strip out newline characters and rebuild the string so it is new line character free.


char * token;
char separators[]="\n";
char chsso_token[1024];

Action()
{

token = (char *)strtok(lr_eval_string("{sso}"),separators);
while (token != NULL) {
	  lr_output_message("%s", token);
	  strcat(chsso_token,token);
	  token = (char *)strtok(NULL, separators);
	}
lr_save_string(chsso_token,"sso_token");
	
}

The {sso} LoadRunner oparameter above was a result of a web_reg_save_param from a previous http post

Advertisement
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.