Hi
@NayanaH_PThe easy way to achieve this is using the split function that you found in the "Utility - Strings" VBO.
But, if you are asking for the logic behind , let's think how can we build our own "Split" function in Blue Prism.
First you need is to implement a loop. When we talk about loops, they don't necessarily have to be loops made with the Loop Stage. A circular path is also a loop.
We need a circular path, because we don't have any collection to iterate with the Loop stage. But, what need to put inside? Usually, when we talk about separate "things", we have a full list of this "things" (a full sentence with words), and this "things" are separated from each other by a separator.
Understanding this, you have a sentence with words, and this words are separate by an space. The first word start in the position 0 of the sentence until the first separator, the second one start in the first separator until the second separator....
So far so clear.
To know the position of a character inside the text you need to use the function "InStr". Of course, our text have 3 separators, this functions returns only the first separator that it founds.
Then you can use the function "Mid" to get the "sub text" from the entry text. The Mid function take 3 parameters, the original text, the start position, and the length. Allways the start position that we want is 1. And the length? Easy, the length is the char index of the first separator (Using the InStr function). And you get the first word!!!
But... where is the loop?
We have the method to get only the first word in the sentence... how can we make to get the second one? Easy, delete the first word from the setence and repeat the previous logic (Take the sub string using the Mid function...). There is no "delete" function, but exists "Replace" this function replace from one original text, one text for another.
In our example.... I get the first word "This" and I will replace "This " (adding an space at the end) from "This is the sentence". And I get returned "is the sentence."
My loop stop when I have no more text inside the original string (Or in other words, when the length of the text is equal to 0)
And this is all. Is clear all the logic?
Hope this helps you! And if this solves the problem, remember mark this as the best answer
😄See you in the Community, bye
🙂------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------