LoadRunner中截取字符串
![](https://images2015.cnblogs.com/blog/491580/201510/491580-20151022125221942-553287695.png)
![](https://images2015.cnblogs.com/blog/491580/201510/491580-20151022125222286-1471976774.png)
/*strchr和strrchr的区别*/
char *strTest1="citms citms";
char *strTest2,*strTest3;
strTest2=(char *)strchr(strTest1,'t'); //在strTest1中顺序查找字符t,当第一次碰到t的时候开始往后截取。
lr_output_message("the first occurrence of t :%s ",strTest2);
strTest3=(char *)strrchr(strTest1,'t'); //在strTest1中倒叙查找字符t,当第一次碰到t的时候开始往后截取。
lr_output_message("the last occurrence of t :%s",strTest3);
![](https://images2015.cnblogs.com/blog/491580/201510/491580-20151022125222583-1396877631.png)
![](https://images2015.cnblogs.com/blog/491580/201510/491580-20151022125223192-592909184.png)
/*strcpy和strncpy,memcpy的区别*/
char *strTest1="citms citms";
char strTest4[50],strTest5[50];
strcpy(strTest4,strTest1); //将strTest1的内容复制到strTest4里面。
lr_output_message("%s",strTest4);
strncpy(strTest5,strTest1,4); //将strTest1的内容,从开始截取4位,复制到strTest5里面
lr_output_message("%s",strTest5);
strcpy(strTest4,"abc abc"); //在字符串中“