解决了

如何削减产出/缓冲值吗


Userlevel 5
徽章”title= + 2
  • 社区经理
  • 72回复

我想修剪的左和右的文本空白值的缓冲区输出,我怎么能在文本修剪吗?

(最初要求和解决支持中心)

图标

最佳答案社区管理员2023年7月31日,接下来

You can use the following syntax to remove spaces at either end of your string. Assuming the you have the string stored in a buffer variable called \"Variable<\/strong>\" :<\/p>

{CALC[TRIM(\"{B[Variable]}\")]}<\/strong><\/p>

\u00a0<\/p>

Use the\u00a0TC Set Buffer<\/strong>\u00a0generic module in your test case as follows:<\/p>

For the value of the Sub attribute \"Buffer<\/strong>\" use the same variable name i.e. Variable<\/p>

For the value of the sub attribute \"Value<\/strong>\" use the syntax given above i.e.\u00a0{CALC[TRIM(\"{B[Variable]}\")]}<\/p>

\u00a0<\/p>

The result of the execution will be stored in the buffer variable \"Variable<\/strong>\"<\/p>","className":"post__content__best_answer"}">

查看原始

14日回复

Userlevel 3
徽章”title= + 2

您可以使用以下语法来删除空格字符串的末尾。假设你有字符串缓冲变量存储在一个称为“变量”:

{CALC[修剪(“{B(变量)}”)]}

使用TC设置缓冲区通用模块在测试情况如下:

子属性的值”缓冲“使用相同的变量名即变量

子属性的值”价值“使用上面给出的语法即{CALC[修剪(“{B(变量)}”)]}

执行的结果将存储在缓冲区变量”变量

Userlevel 5
徽章”title= + 2

我得到错误,“没有合适的价值发现的命令“钙”,你能告诉我什么是错的

Userlevel 3
徽章”title= + 2

测试下你的价值来自于您的应用程序时,您还可以使用验证的操作模式,然后使用XB-Syntax所以价值得到缓冲没有空白——例如,你的“文本”应用程序,你只需要缓冲区中“文本”,验证对:我{XB(变量)},应该没有空白的商店。

Userlevel 5
徽章”title= + 2

我想要一个巨大的一部分字符串的字符6 - 14所示。

只使用部分缓冲模块:/模块/标准模块/ TBox自动化工具/缓冲区操作/ TBox部分缓冲区

Userlevel 3
徽章”title= + 2

使用在TBOX设置缓冲模块。

假设你的缓冲区有价值:ToscaUser001

{CALC[左(”“”“{B【用户名】}”“”,5)]}=托斯卡

{CALC[右”“”“{B【用户名】}”“”,3)]}= 001

Userlevel 5
徽章”title= + 2

我需要添加一个“3或5后在你的例子中,11个工作版本。

{CALC[权利(“”“{B【用户名】}”“”,3”)]}= 001

Userlevel 5
徽章”title= + 2

我可以这样吗?

如果价值= " Tosca123 "

我只需要= " sca123 "

这有可能吗?

Userlevel 3
徽章”title= + 2

最初的例子将在TBox工作只要你记得quadruple-double-quote规则字符串。换句话说,使用{CALC[修剪(”“”“{B(变量)}" " " ")]}而不是{CALC[修剪(“{B(变量)}”)]}。

Userlevel 5
徽章”title= + 2

我试图截断多余的空间我有缓冲之前和之后的一个值。

然而,当我试着用{CALC[修剪(”“”“{B(变量)}" " " ")]}格式,托斯卡返回值为{B(变量)}。

当我试着使用{CALC[修剪(“{B(变量)}”)]}格式,托斯卡返回下列错误:

“表达修剪(< BufferValue >)在ms excel公式是无效的。详情请粘贴ms excel的表情。”

你能请让我知道,如果我缺少一些重要的细节吗?

Userlevel 3
徽章”title= + 2

找到了一个解决方案使用模块TC字符串操作:

Userlevel 5
徽章”title= + 2

即使这个问题很旧,我想指出一个比上面所有的建议简单的解决方案:使用正则表达式

https://documentation.188金宝搏app苹果下载软件tricentis.com/tosca/1300/en/content/tbox/regular_expressions.htm Extractingtextusingregularexpressions

在你的例子:

{Regex (“[\ s] * (? < stringbuffer > [a - z d | \] *) [\ s] * ")}

应该存储字符串你正在寻找进入缓冲区stringbuffer。

这个功能应该知道更好。

Userlevel 3
徽章”title= + 2

一个非常简单的方法是使用验证缓冲区:

(在前面和后面的xb应该是空白的!)

91952 eaadbd3c0584d5d2b24ca9619d4.iix”></p>
           <p></p>
           <p>开始:“Hello World”</p>
           <p>结果:“Hello World”</p>
          </div>
          <div class=

A very simple way is to work with verify Buffer:<\/p>

(in front of\u00a0and behind the xb should be a blank!)<\/p>

\u00a0<\/p>

\"91952eaadbd3c0584d5d2b24ca9619d4.iix\"<\/p>

\u00a0<\/p>

Start: \" Hello World \"<\/p>

Result: \"Hello World\"<\/p>","quoteUsername":"Community Administrator","translations":{"Common":{"like":"Like","unlike":"Unlike"},"Forum":{"Quote":"Quote & Reply","Share":"Share"}}}">


Userlevel 3
徽章”title= + 2

快速更新,因为这非常古老的问题仍然是一个最受欢迎的内容:

托斯卡14.2介绍了{修剪}字符串操作。这将是完美的解决方案。可选参数[开始]或[结束]只有空白一开始或结束修剪。

{修剪(InputText)(可选参数)}

例如:{修剪[{B [Buffer1]}]}

Userlevel 5
徽章”title= + 2

您可以简单地使用{修剪[{B [value_to_call_buffer]}]},修剪属性是要修剪所有前导和尾随空白,

回复


Learn more about our cookies.<\/a>","cookiepolicy.button":"Accept cookies","cookiepolicy.button.deny":"Deny all","cookiepolicy.link":"Cookie settings","cookiepolicy.modal.title":"Cookie settings","cookiepolicy.modal.content":"We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.<\/a>","cookiepolicy.modal.level1":"Basic
Functional","cookiepolicy.modal.level2":"Normal
Functional + analytics","cookiepolicy.modal.level3":"Complete
Functional + analytics + social media + embedded videos"}}}">
Baidu