解决了

基于分离器分离缓冲

  • 2023年7月31日
  • 1回复
  • 4的观点

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

你好,

抱歉问许多问题我表工作首次托斯卡所以让很多怀疑。

我的问题是:我必须提供缓冲超过一个值使用任何分隔符和我必须由分裂运行循环缓冲区根据分隔符。

为例:我缓冲应该累积,CNAME当我分裂,那么缓冲区(0)应该CNUM并执行验证的行动,然后选择缓冲应该CNAME (1)。

我真的很感激你的帮助和时间。

提前谢谢。

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

图标

最佳答案社区管理员2023年7月31日14:34

Please see the solution in the screenshot attached.\u00a0<\/p>

Step by step explanation of the code:<\/p>

1) Using the TBox Set Buffer module, I have stored the string input ABC,BCD,DEF in the buffer named as InitiatlBuffer<\/p>

2) Using the TC String Operations, I have got the count of the separator , in the buffer Count. So as per logic, number of words in the buffer will be the number of separators + 1.<\/p>

3) I have created a test step folder at which I have set the value of the property Repetition at the folder level as {B[Count]} which means that the steps inside this folder will be repeated as many times as the value of the buffer Count.<\/p>

4) Inside the folder Split buffer I have used 2 steps:<\/p>

\u00a0 \u00a0 1) In the step, Tbox Set Buffer, I am using {XB} to extract one word from the InitialBuffer and then extract the remaining substring.<\/p>

\u00a0 \u00a0 \u00a0 \u00a0 The expression\u00a0InitialBuffer:\u00a0 {XB[Buffer{Repetition}]},{XB[RestString]}<\/strong>\u00a0with the action mode as verify works as follows:\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Since the value in InitialBuffer is ABC,CDE,DEF so using XB stores the first word that is ABC in the buffer called Buffer1 (since the\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 value of Repetition is taken dynamically at run time) and stores the rest half of the string BCD,DEF in the buffer RestString.<\/p>

\u00a0 \u00a0 \u00a0 \u00a0 Then it stores the value of RestString in InitialBuffer and writes the value of Buffer1 in the new buffer named as Buffer[1] as you\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 want the split buffers in the format Buffer[1], Buffer[2] and so on. This is what gets performed when value of Repetition is 1<\/p>

\u00a0 \u00a0 \u00a0 \u00a0 Similarly, the value of Repetition is 2 now, value of InitialString is BCD,DEF. The same steps as explained above get executed and\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 once repetition is executed, you have the values as:<\/p>

\u00a0 \u00a0 \u00a0 \u00a0 Buffer[1]= ABC, Buffer[2]=BCD and RestString= DEF<\/p>

5) In the last step, since the total number of words is 3 that is {B[Count]}+1. So storing the value extracted in buffer RestString to the buffer\u00a0Buffer[{MATH[{B[Count]}+1]}] i.e Buffer[3]. So in Buffer[3] the last word gets stored as DEF.\u00a0<\/p>

\u00a0<\/p>

This logic seems generic to work with any number of words you store in the buffer.<\/p>

\u00a0<\/p>

Hope this helps !!\u00a0<\/p>","className":"post__content__best_answer"}">

查看原始

1回复

Userlevel 3
徽章 + 2

请参阅附上截图上的解决方案。

一步一步解释的代码:

1)使用TBox集缓冲模块,存储字符串输入ABC,命名为InitiatlBuffer BCD, DEF缓冲区

2)使用TC字符串操作,我有计数的分隔符,在缓冲计数。所以按逻辑,缓冲的单词数量将分隔符的数量+ 1。

3)我已经创建了一个测试步骤文件夹在我设置的值属性重复在文件夹级{B[数]}这意味着在这个文件夹的步骤会重复多次缓冲区数的值。

4)文件夹内分裂缓冲我用2个步骤:

在步骤1),Tbox设置缓冲区,我用{XB}从InitialBuffer中提取一个词,然后提取剩余的子字符串。

表达式InitialBuffer: {XB[缓冲{重复}]},{XB [RestString]}与行动模式验证工作如下:因为InitialBuffer的价值是ABC, CDE, DEF所以使用XB商店ABC的缓冲区的第一个词叫做Buffer1(因为重复的值是在运行时动态)和商店其余一半的字符串BCD, RestString DEF的缓冲区。

然后它存储的价值RestString InitialBuffer和写的价值新缓冲区称为缓冲区Buffer1[1]你想分裂缓冲区的格式缓冲[1],缓冲[2]等等。这就是时执行重复的值是1

同样的,重复的值是2,价值InitialString BCD, DEF。相同的步骤如上解释执行,一旦重复执行,你的值为:

缓冲区[1]= ABC,缓冲区[2]= BCD和RestString = DEF

5)在最后一步中,因为单词的总数是{B[数]}3 + 1。所以将值提取存储在缓冲区RestString缓冲缓冲区({数学[{B[数]}+ 1]}]。e缓冲[3]。所以在缓冲[3]最后一句话作为DEF存储起来。

这种逻辑似乎通用处理任意数量的单词你存储在缓冲区。

希望这有助于! !

回复


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
map