How to generate all words from a given sequence of strings ? Regular expression can help on that ?
Example : I have the following set of strings : a, bc, def, I want to get all available string combinations after concatenating those strings :
Note : Here the number of string is 3, I want to have generale rule to be applied for that : > 3 sets of strings ( Like reading the same from excel column).
Thanks in advance
This is a typical programming question for students
The best way to do this is through something called “recursion”. Recursion - GeeksforGeeks
You could also do this with for-loops, but it’s messy and not recommended.
Depending on your programming knowledge, this might help you: Print all possible strings of length k that can be formed from a set of n characters - GeeksforGeeks
Once you understand this, you should be able to translate this into UiPath “code”.
If you don’t understand this, I can show you how to build it in UiPath.
Thanks a lot @T0Bi for prompt feedback.
In fact I find some codes written in different languages but not able to convert that into UiPath format, Could you please help on that with simple example ?
Thanks in advance
Well yes, the question is, do you want me to simply build a solution for you, or do you want to understand it?
If you want to understand it, try to understand both posts (and the code). Once you understand how recursion works, you can easily build this in UiPath.
In the meantime, I’ll try to build you an example workflow
Thanks for Pushing me to understand rather than getting the code directly;
Anyway I will try to build the same in the coming hours , if not possible to do that I will ping you to share what you did from your side
Hello @T0Bi , Please share your code, if already done, I’m stuck and I need it by today . Thanks in Advance
recursion.zip (38.9 KB)
Here you go.
Please mark the answer as solution.
The process only prints the strings, but you can easily return them via arguments or simply use add to collection to add them to a list.
Thanks @T0Bi , Tell me Which Packages you include in this Workflow? Because I got many error when opening the same. Seems you’re using newer version of UiPath.
I have deleted the JSON file and start again but still got the following Errors :
Thanks in Advance
@hsendel which UiPath version are you using?
It seems like you’re missing the updated 21.4 activities.
This is just the invoke workflow activity, you can replace it with yours if you don’t want to upgrade.
Thanks a lot @T0Bi , Works fine, just my query is to print combinations without repetitions, I will try to manage that based on your code.
I need only the following combinations :
a def bc
bc def a
bc a def
def a bc
def bc a
By the way I see the output is restricted to 3 items only even if the input is More than that, no?
I don’t think I have repetitions in there, do I?
Ahh… now I now what you mean
You can change the 3 to whatever value you like in the first invoke workflow activity.
Change the value of in_length here
Great !!! Still only one issue , How to remove those repetitions ?
By repetitions I mean there will be only the appearance of each character once in the output.
if the input is “a” , “b” , “c” I need to have only the following :
abc, acb, bca, bac, cab, cba…and no need for aaa, bbb, ccc, aab, aac…etc
It’s a small workaround but the easiest way for now:
I basically added two activities to create a new List with the remaining strings and used that going forward.
printAllStringsRec.xaml (9.0 KB)
Thank a lot @T0Bi …Well Done
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.