C-Language functions that convert string case in LoadRunner

Source: Internet
Author: User

      The C language function that converts string case in LoadRunner. LoadRunner Language ccharacterstringaction encapsulation converttoxxx function://converttoupper functionint Conve Rttoupper (char * sInput, char * snew) {sInput = (char *) STRUPR (sInput); lr_save_string (sinput,snew);}//converttolower Fun Ctionint Converttolower (char * sInput, char * snew) {sInput = (char *) STRLWR (sInput); lr_save_string (sinput,snew);}//conv Erttotitle functionint converttotitle (char * sInput, char * snew) {int i = 0, s = 0, l = 0; char buf1[50]; char buf2[2]; c  Har N; Copy a single character into the address of [n] strncpy (&n,sinput+i,1); Copy the single character into Buf2 sprintf (buf2, "%c", N); Convert the contents of Buf2 to uppercase STRUPR (BUF2); Overwrite the contents of Buf1 with Buf2 strcpy (BUF1,BUF2); i++;  while (I < strlen (sInput)) {//Overwrite buf2 with one character strncpy (&n,sinput+i,1);  sprintf (Buf2, "%c", N);   If the previous character is a space then make the current character upper case if (s = = 1) {STRUPR (BUF2);strcat (BUF1,BUF2);  s = 0;   }//Otherwise convert to lower case and concatenate the current character into the string buf1 else{strlwr (BUF2);  strcat (BUF1,BUF2); }//If the current character are a space set the value of [s] to [1] So, the next character gets capitalised If (strc  MP ("", Buf2) ==0) {s = 1; } i++; } lr_save_string (buf1,snew);}       Use the converttoxxx conversion function: Action () {lr_save_string ("testing is Believing", "str");       Converttoupper (lr_eval_string ("{str}"), "upperstr");     Lr_output_message (Lr_eval_string ("{upperstr}"));       Converttolower (lr_eval_string ("{str}"), "lowerstr");        Lr_output_message (Lr_eval_string ("{lowerstr}"));       Converttotitle (lr_eval_string ("{str}"), "titlestr");        Lr_output_message (Lr_eval_string ("{titlestr}")); return 0;} Output: Virtual User Script started at:2010-01-30 17:53:13starting action Vuser_init. Web Turbo Replay of LoadRunner 9.50 SP1 for WINXP; WebReplay96 build 7045 (May 14:28:58) [msgid:mmsg-27143]run mode:html [msgid:mmsg-26000]run-time Settings file: "D:/xlsoft/lr/mytest/converttoxxxx//default.cfg" [msgid:mmsg-27141] Ending action Vuser_init. Running VUser ... Starting Iteration 1.Starting Action Action.action.c (+): Testing is BELIEVINGACTION.C ($): testing is BELIEVINGACTION.C (+): Testing is believingending action action.ending iteration 1.Ending VUser ... Starting action Vuser_end. Ending action vuser_end. VUser Terminated.

C-Language functions that convert string case in LoadRunner

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.