gpt4 book ai didi

automated-tests - 如何在使用Robot Framework时从字符串中修剪或去除空格

转载 作者:行者123 更新时间:2023-12-04 09:25:36 34 4
gpt4 key购买 nike

如何在使用Robot Framework时从字符串中修剪或去除空格

如果我有一个字符串“你好,你好吗”
如何将其转换为“HelloHowareyou”(去除所有空白)

最佳答案

$ {str.strip()}也可以使用。它使用Extended variable syntax示例:

*** 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运行,以查看传递给log关键字的内容。

关于automated-tests - 如何在使用Robot Framework时从字符串中修剪或去除空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17832094/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com