Lr中关于字符串的截取

Action()
{
    char separators[] = "\"processId\":\"";//截取条件
    char * token;
    char * temp;
    lr_save_string("\"bz\":null,\"processId\":\"3144","str");//截取的原始串
    token = (char *)strtok(lr_eval_string("{str}"), separators); // Get the first token
    if (!token) {
      lr_output_message ("No tokens found in string!");
      return( -1 );
    }
        while (token != NULL ) { // While valid tokens are returned
        temp = token;
        lr_output_message ("结果值:%s", token );
        token = (char *)strtok(NULL, separators); // Get the next token
    }
    lr_output_message ("最后获取的值:%s", temp );
    return 0;
}

 

posted @ 2016-11-15 16:45  Tester_ABX  阅读(893)  评论(0)    收藏  举报