zoukankan      html  css  js  c++  java
  • jmeter ---常用字符串相关函数

    主要的函数如下:

    1.将字符串转为大写或小写: ${__lowercase(Hello,)}  ${__uppercase(Hello,)}
    2.生成字符串:  __RandomString函数 
    3.取字符串中的子串:  __substring函数
    4.从文件中按行取字符串:   _StringFromFile函数   (注:然后取子串,进行处理,取行中特点的值)
    5.分割字符串  用指定的分割符分割:  __split或者${__javaScript( "aaa|bbb|ccc".split("|")[1],d1)}

    函数的组合使用
    文件test.txt中每行数据的格式为:13400000001,123456
    要求:从文件中取出手机号,作为参数
    方法:
    1.先利用__StringFromFile函数从文件中取出一行数据
    即:${__StringFromFile(e: est.txt,,,)}

    2.然后利用__substring函数取出行数据中的前11个字符,即手机号,如下:
    ${__substring(${__StringFromFile(e: est.txt,,,)},0,11,)}

    3.__lowercase函数  __uppercase函数  转变大小写
    ${__lowercase(Hello,)}
    ${__uppercase(Hello,)}

    4.__RandomString函数  生成特定长度,由指定的字符组成的字符串
    ${__RandomString(5,abcdef,teststr)}

    5.__substring函数  取字符串中的子串,指定起始下标
    ${__substring(hell world,5,10,)}
        
    6._StringFromFile函数  从文件里面取数据,按行取

    7._StringFromFile函数是从一个文件中读取一个字符串,用来实现参数化,
    一次读取一行
    ${__StringFromFile(E: est.txt,test,,)}

    8.__FileToString函数   将文件转换为字符串
    ${__FileToString(e: est.txt,,)}

    ${__split(${string},,)}  分割字符串

    9.另一种js分割方法
    ${__javaScript( "aaa|bbb|ccc".split("|")[1],d1)}
  • 相关阅读:
    使用Power Shell 拉取项目源代码
    C# 读取excel数据到datatable
    C# 导出datatable数据到excel
    redis过一段时间连接不上
    windows10 docker volume
    通过端口查询到应用
    centos清理磁盘
    maven镜像加速
    IDEA常用插件
    java开发常用软件
  • 原文地址:https://www.cnblogs.com/saryli/p/9858770.html
Copyright © 2011-2022 走看看