loadrunner统计字符串中指定字符出现的次数

Action()
{

	char *str="sdfas1,sdfsdf2,sdfsdfsdfdsf3,sdfsdfsdfsdfds4,fsdfdsf5,sdfdsfsd6,fsdfsd7sdfas8";

	int i,count=0;

	while(strstr(str,",") != NULL){

		count++;

		str=(char *)(strstr(str,",")+1);

		lr_output_message("%s",str);
	}

	lr_output_message(",出现 %d 次",count);



	return 0;
}

深圳湖北籍软件测试群 275212937

原文地址:https://www.cnblogs.com/qmfsun/p/4933034.html