如何修剪或同时使用机器人框架从字符串中去除空格 [英] How to trim or strip white spaces from a String while using Robot Framework
本文介绍了如何修剪或同时使用机器人框架从字符串中去除空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何修剪或同时使用机器人框架从字符串中去除空格
How to trim or strip white spaces from a String while using Robot Framework
如果我有一个字符串你好你怎么样
如何将它转换为HelloHowareyou(剥离所有空格)
If I have a string " Hello How are you " how to convert it to "HelloHowareyou" (stripping all the white spaces)
推荐答案
另外$ {str.strip()}工作。它使用<一个href=\"http://robotframework.google$c$c.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.1#extended-variable-syntax\">Extended变量语法示例:
Also ${str.strip()} works. It uses the Extended variable syntax Example:
*** Variables ***
${str}= ${SPACE}${SPACE}${SPACE}foo${SPACE}${SPACE}${SPACE}
*** Test cases ***
print string
log ${str} # will be printed with spaces around it
log ${str.strip()} # will be printed without spaces around it
与pybot -L TRACE运行看被传递哪些记录关键字。
Run with pybot -L TRACE to see what is being passed to log keyword.
这篇关于如何修剪或同时使用机器人框架从字符串中去除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文