LoadRunner中字符串替换

mac2022-06-30  106

Action(){ char dest[500]=""; char src[500]="%E9%AB%98%E4%B8%AD"; char oldstr[100]="%"; char newstr[100]="**";

char * position; int stringlen=0;

//如果源字符串为空 if(strlen(src)==0) { return 0; }

//如果源字符串不包含oldstr position=(char *)strstr(src,oldstr);

if(position==NULL) { return 0; }

while(position!=NULL) { stringlen=strlen(src)-strlen(position); memset(dest,0,500); strncpy(dest,src,stringlen); strcat(dest,newstr); position=position+strlen(oldstr); strcat(dest,position); strcpy(src,dest); position=(char *)strstr(src,oldstr); }

lr_output_message("%s",src);

return 0;}

 想封装成动态链接库

 

转载于:https://www.cnblogs.com/lansexingxing/p/3718818.html

相关资源:LoadRunner中转换字符串到URL编码
最新回复(0)