String Token Function

STRING TOKEN
How to split the string in load runner


 Action()
{


char a,b,c;
char *value="040;350;07/05/2012";
char *temp;


lr_save_string(value,"TokenValue_1");
temp=(char *)strtok(lr_eval_string("{TokenValue_1}"),";");

lr_save_string(temp,"TokenValue1");
a=lr_output_message("%s",lr_eval_string("{TokenValue1}"));
lr_output_message("the string  a = %s",lr_eval_string("{TokenValue1}"));


temp=(char *) strtok(NULL,";");


lr_save_string(temp,"TokenValue2");

b=lr_output_message("%s",lr_eval_string("{TokenValue2}"));
lr_output_message("the string  b = %s",lr_eval_string("{TokenValue2}"));


temp=(char *) strtok(NULL,";");


lr_save_string(temp,"TokenValue3");
c=lr_output_message("%s",lr_eval_string("{TokenValue3}"));

lr_output_message("the string  c = %s",lr_eval_string("{TokenValue3}"));


    return 0;
}

16 comments:

  1. The out put value is :
    Starting iteration 1.
    Starting action Action.
    Action.c(14): 040
    Action.c(15): the string a = 040
    Action.c(23): 350
    Action.c(24): the string b = 350
    Action.c(31): 07/05/2012
    Action.c(33): the string c = 07/05/2012
    Ending action Action.
    Ending iteration 1.

    ReplyDelete
  2. good stuff ....expecting few more articles from you

    ReplyDelete
  3. Hi Shankar, The example is good but a have a question here......

    For example if we have the value[] ="test\12345#678.999#Solutions"; and with 3 delimiters(\#.) how can we pass them...It is not recognizing the delimiter \ .Are you able to help me on this..

    Thanks,
    Krishna

    ReplyDelete
  4. Great Help.. Thank You.. :)

    ReplyDelete
  5. Hi Shankra,

    I am learning LOADRUNNER. Can you please help me to solve more issues in CORRELATION.
    ie. How to handle dynamic boundary values ?

    ReplyDelete
  6. Hi Shankra,

    I am learning LOADRUNNER. Can you please help me to solve more issues in CORRELATION.
    ie. How to handle dynamic boundary values ?

    ReplyDelete
  7. The Best HP Load Runner Online & Corporate Training
    Live Performance Testing Training Classes by Experts
    WiseInfo Solutions offers performance testing consulting and training services for individuals and corporate as well as project support and resources to bring software testing expertise .Our testing services are designed and delivered by experienced professionals focused on Quality.
    Wiseinfo Solutions provides an introduction to the complexities of software performance testing and delivers testing skills that participants can immediately apply back on the job.
    Features ::
     25 Member Real time Performance testing professionals
     Live Job Oriented Training
     Live Instructor Led Course
     Real World Case Study
     Batch Flexibility
     Customized Course
     Live Projects
     Resume Preparation
    Performance testing Tools
     Performance Engineering & Tuning
     Loadrunner
     Jmeter
     RPT
     NeoLoad
     WebLoad
     Silk Performer
    Mode of training::
     Online & Offline
     Fast Track & Regular
     Weekend
    Contact ::
    Satish :: +919505376239
    Mail:: satish.mandadi@outlook.com
    https://wiseinfosolutions.wordpress.com/

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. How would you break long junk strings like 12345ajsdadja.12323? can we use strtok ?

    ReplyDelete
  10. Can you please share an example on VTS concept?

    ReplyDelete

  11. Hello, Good Article you know your article it's useful me and Thanks for Sharing Information.
    Load runner Training in Delhi

    ReplyDelete
  12. The Sites are filled with Full of Encouraging and Enhancing Stuffs...I am very Happy to see all the Articles...Thanks for this Kind work
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete

About ShankarChinn

My photo
Bangalor, karnataka, India
I created this Blog to store knowledge and help other with the same. URL:http://shankarchinn.blogspot.in/ By : Shankar Nath.Chokkam