strlen:获取字符串的长度
char str[20]="容我想想";
int len;
len = strlen(str);
lr_output_message("str的长度=%d",len);
Action.c(9): str的长度=8
strupr:将小写字母转化为大写字母
char str[20] ="Welcome to the HP LoadRunner Online Function Reference";
char *str1 = NULL;
str1 = (char *)strupr(str);
lr_output_message("str的内容转化为大写为%s",str1);
strlwr:将小写字母转化为大写字母
char str[20] ="RONGWOXIANGXIANG";
char *str1 = NULL;
lr_output_message("str的内容转化为小写为%s",strlwr(str));
strrchr:在字符串中查找指定字符最后一次出现
char *str="Welcome to the HP LoadRunner Online Function Reference";
char *str1;
str1 = (char *)strrchr(str,'c');
lr_output_message("c 最后一次出现时在%s",str1);
strchr:在字符串中查找字符第一次出现
char *str="Welcome to the HP LoadRunner Online Function Reference";
char *str1;
str1 = (char *)strchr(str,'c');
lr_output_message("c第一次出现是在%s",str1);
strncpy:拷贝指定长度的字符串
char str[100]="容我想想老师之性能测试系列培训课程";
char str1[100];
strncpy(str1,str,8);
lr_output_message("str的值为%s",str1);
strcpy:拷贝字符串
char str[100]="容我想想老师之性能测试系列培训课程";
char str1[100];
strcpy(str1,str);
lr_output_message("str的值为%s",str1);
strnicmp:不区分大小写比较指定长度的字符串
char str[100] ="Welcome to the HP LoadRunner Online Function Reference";
char str1[100]="WELCOME TO THE HP LOADRUNNER ONLINE FUNCTION REFERENCE";
int num;
num = strnicmp(str,str1,10);
if(num == 0)
lr_output_message("str == str1");
else if(num > 0)
lr_output_message("str > str1");
else if(num < 0)
lr_output_message("str < str1");
stricmp:不区分大小写比较字符串
char str[100] ="Welcome to the HP LoadRunner Online Function Reference";
char str1[100]="WELCOME TO THE HP LOADRUNNER ONLINE FUNCTION REFERENCE";
int num;
num = stricmp(str,str1);
if(num == 0)
lr_output_message("str == str1");
else if(num > 0)
lr_output_message("str > str1");
else if(num < 0)
lr_output_message("str < str1");
strncmp:比较指定长度字符串
char str[100] = "Welcome to the HP LoadRunner Online Function Reference";
char str1[100]= "Welcome TO THE HP LOADRUNNER ONLINE FUNCTION REFERENCE";
int num;
num = strncmp(str,str1,8);
if(num == 0)
lr_output_message("str == str1");
else if(num > 0)
lr_output_message("str > str1");
else if(num < 0)
lr_output_message("str < str1");
strncmp:字符串比较
char str[100] = "Welcome to the HP LoadRunner Online Function Reference";
char str1[100]= "Welcome TO THE HP LOADRUNNER ONLINE FUNCTION REFERENCE";
int num;
num = strcmp(str,str1);
if(num == 0)
lr_output_message("str == str1");
else if(num > 0)
lr_output_message("str > str1");
else if(num < 0)
lr_output_message("str < str1");
strcat:拼接字符串
char str[100]="容我想想";
char str1[100]="老师之性能测试系列培训课程";
char *str2;
str2 = (char *)strcat(str,str1);
lr_output_message("str1的值为%s",str2);
strncat:拼接指定长度字符换
char str[100]="容我想想";
char str1[100]="老师之性能测试系列培训课程";
char *str2;
str2 = (char *)strncat(str,str1,22);
lr_output_message("str1的值为%s",str2);
memcpy:拷贝指定长度的字符串
char str[100]="容我想想老师之性能测试系列培训课程";
char str1[100]="";
memcpy(str1,str,30);
lr_output_message("str1的值为%s",str1);
memcmp:比较指定长度的字符串
char str[100]="容我想想老师之性能测试系列培训课程TEST";
char str1[100]="容我想想老师之性能测试系列培训课程";
int num;
num = memcmp(str1,str,34);
if(num == 0)
lr_output_message("str == str1");
else if(num > 0)
lr_output_message("str > str1");
else if(num < 0)
lr_output_message("str < str1");