• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
灿灿子
博客园    首页    新随笔    联系   管理    订阅  订阅

robotfromwork String库

1.转换为小写  Convert To Lower Case使用的是python  lower()方法

2.转换标题大小写Convert To Title Case  example[.!?]? 如果第二个单词为大写 第一个单词小写不错大小写转换  例: ${str2}  Convert To Title Case  it's an iphone pro abc  exclude=ab.?  It's An Iphone Pro abc

3.转换位大写Convert To Upper Case使用的是python  lower()方法upper()

4.将字节解码为字符串 Decode Bytes To String/将字符串编码为字节Encode String To Bytes

${string} = Decode Bytes To String ${bytes} UTF-8  
${string} = Decode Bytes To String ${bytes} ASCII errors=ignore

${bytes} = Encode String To Bytes ${string} UTF-8  
${bytes} = Encode String To Bytes ${string} ASCII errors=ignore

5.从左侧获取Fetch From Left返回第一次出现之前的内容如果不到,则返回整个字符串。

6.从右侧获取Fetch From Right返回最后一次出现后的的内容,如果找不到,则返回整个字符串。

7.格式字符串  Format String  ${to} Format StringTo: {} <{}>   cancan    cancan@qq.com   ${to} Format String{:*^30} {:*^30}    cancan    lion    **********dingcancan********** *************lion*************

Format String {0:{width}{base}} ${42} base=X width=10  base=X width=10  指空格

Format String${CURDIR}  positional   获取当前路径

8.产生随机字串  Generate Random String ${to} Generate Random String12   01  12位0  1  之间的数  LOWER小写  UPPER大写  NUMBERS0到9的数字 [NUMBERS]abcdef数字和字母  abcdef纯字母

9.Get Line  Get Line Count

   ${string}   Catenate    111111111111111${\n}1111111111111111111${\n}111111111

   ${first} Get Line Count  ${string}  

   ${first} Get Line  ${string}   -1

10.获取包含字符串的行 Get Lines Containing String

${string} Catenate 111111111111111111${\n}333344445555
${first} Get Lines Containing String ${string} 5  case-insensitive(区分大小写)

11.Get Lines Matching Pattern

${string} Catenate 1${\n}333344445a555
${first} Get Lines Matching Pattern ${string} [1]

12.Get Substring

${string} Catenate 123456321
${first} Get Substring ${string} 2 5

13.Remove String ${str} = Remove String Robot Framework o bt

14.Replace String ${string} Catenate 123123123  ${first} Replace String ${string} 1 b count=2  b23b23123d

15.分割字符串 Split String  ${string} Catenate 123123123  ${first} Split String ${string} 3 1              ['12', '123123']        ${first} Split String To Characters   sasdfasdfsdafdsfdsfsdfdsf

16.Split To Lines  

${string} Catenate 1231${\n}23123
${first} Split To Lines ${string} -1

17.Strip String

 

posted on 2021-02-20 17:09  灿灿子  阅读(224)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3