LoadRunner string concatenation function strcat

Source: Internet
Author: User
Tags mongodb postgresql redis
Char*strcat (char*to,constchar*from); appends a string to another string
Example:
Lr_save_datetime ("Today is%m month%d day%y", Date_now, "Today");
//output: Today = today is March 11 2016
Lr_save_datetime ("Tomorrow is%m month%d%y year", Date_now+one_day, "Tomorrow");
//output: tomorrow = Tomorrow is March 12 2016
strcat (temp,lr_eval_string ("{Today}"));//Append the value of the variable today to the end of Temp
lr_message ("temp=%s", Temp);//output: Temp=today is March 11 2016
strcat (Temp,lr_eval_string ("{Tomorrow}")); //Append the value of the variable today to the end of temp
Lr_message ("temp=%s", Temp);
Output: Temp=today was March 11 2016 tomorrow is March 12 2016
Do you see it.
Another example of a string intercept function + string concatenation function:
Char *papernum;
Char *year;
Char *month;
Char *day;
Char birthdate[200];
Char *str;
Save 441301198005059899 to Variable Papernum
Lr_save_string ("441301198005059899", "Papernum");
To intercept a year in a variable papernum
Lr_save_var (Lr_eval_string ("{papernum}") +6,4,0, "year");
Capturing the month in a variable papernum
Lr_save_var (Lr_eval_string ("{papernum}") +10,2,0, "month");
Intercept the date in the variable Papernum
Lr_save_var (Lr_eval_string ("{papernum}") +12,2,0, "Day");
Save-to Variable str
Lr_save_string ("-", "str");
strcat (Birthdate,lr_eval_string ("{year}");
strcat (birthdate,lr_eval_string ("{str}"));
strcat (Birthdate,lr_eval_string ("{Month}"));
strcat (birthdate,lr_eval_string ("{str}"));
strcat (Birthdate,lr_eval_string ("{Day}"));
Lr_message ("birthdate=%s", birthdate);//Last Output: birthdate=1980-05-05
the strcat () is used above, and the function can also be nested by continuous nesting, shorthand, as follows:
Strcat (strcat (strcat (strcat (strcat ("{year}"), Birthdate,lr_eval_string ("{str}"), lr_eval_string ("{Month}"), Lr_eval_string ("{str}"), Lr_eval_string ("{Day}"));
Do you see it. If you don't understand Lr_save_var (); function, see my other blog:LoadRunner How to use Lr_save_var to intercept arbitrary string lengths
I hope to be of some help to you. 



Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

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.