LR关于对参数进行截取操作的实践

    xiaoxiao2022-07-15  143

    脚本:

    Action() { char *username; lr_output_message("参数值为:%s",lr_eval_string("{NewParam}")); username=lr_eval_string("{NewParam}"); lr_output_message("username的值是:%s",username); lr_output_message("截取后的值:%s",strtok(lr_eval_string("{NewParam}"),"kibon")); //strtok 返回特殊标记分割的字符 lr_save_string((char*)strtok(lr_eval_string("{NewParam}"),"kibon"),"temp"); lr_output_message("变量的值为:%s",lr_eval_string("{temp}")); return 0; }

      执行结果:

    Starting iteration 1. Starting action Action. Action.c(5): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001" Action.c(5): 参数值为:kibon001 Action.c(7): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001" Action.c(9): username的值是:kibon001 Action.c(11): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001" Action.c(11): 截取后的值:001 Action.c(14): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001" Action.c(14): Notify: Saving Parameter "temp = 001". Action.c(16): Notify: Parameter Substitution: parameter "temp" =  "001" Action.c(16): 变量的值为:001 Ending action Action. Ending iteration 1.

       

    最新内容请见作者的GitHub页:http://qaseven.github.io/

       

    相关资源:敏捷开发V1.0.pptx
    最新回复(0)