51Testing软件测试论坛
标题:
strtok函数分割字符串,最后一个分割错误,帮忙分析下
[打印本页]
作者:
smilesun666
时间:
2015-1-22 05:17
标题:
strtok函数分割字符串,最后一个分割错误,帮忙分析下
token = (char *)strtok(lr_eval_string("{str}"),separators); // Get the first token
if (!token) {
lr_output_message ("No tokens found in string!");
return( -1 );
} else{
while (token != NULL ) { // While valid tokens are returned
lr_output_message ("--%s---", token);
strcpy(val[i],token);
lr_output_message("Val # is: %s", val[i]);
// Get the next token
lr_save_string(val[i],"row_idB");
lr_output_message("--%s--", lr_eval_string("{row_idB}"));
token = (char *)strtok(NULL, separators);
i++;
}
str是这样的字符,"4afdfdfadfdfdfad","4afdfd456fdfdfad","4afdfdfaafdfdfdfdfd";
最后一个字符串分割
时分割出来了fadfad,dfd....好多个。是什么原因
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2