在进行 写LR 脚本的时候,肯定是要熟悉C语言的一些特性的,以下把一些平时练习中的C语言的截取函数给整理出
char *string_cut(char *src, char *left, char *right)
{
char path[1024] = "";
char *res = (char *)strstr(src,left);
res = res + strlen(left);
if(strcmp(right, "/0") == 0)
{
return res;
}
strcpy(path, res);
res = (char *)strtok(path, right);
return res;
}
Action()
{
char *testR = "30&test111=2&最后回复时间>11-18 22:19</a></span><span>回复<em>1";
char *testR2;
testR2 = (char *)string_cut(testR, "test111=", "&");
lr_output_message("--------------------截取回复数为:%s",testR2);
return 0;
}