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;
}

12 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
    Replies
    1. use "\\" instead of "\"

      Delete
  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. Online mba in India
    DEIEDU is the best online Institute in the world with high class course outline and up to date learning materials. DEIEDU is providing the online mba in india, online mba in india, Distance learning mba courses in india, Correspondence mba in India Mba from distance in India, Online Executive Mba in India, distance Mba from India, Online distance mba in India. Distance learning mba degree in India.
    Address:
    401, fourth floor sg alpha tower
    Vashundhra (up)
    Phone: 9811210788
    Email: info@deiedu.in
    Website: http://www.deiedu.in/
    online mba in india

    ReplyDelete

About ShankarChinn

My photo
Bangalor, karnataka, India
I created this Blog to store my photos. URL:http://shankarchinn.blogspot.in/ By : Shankar Nath.Chokkam