cancel
Showing results for 
Search instead for 
Did you mean: 

Text to collection

RajsudhapriyaCN
Level 3

Hi All,

Can anyone help me with developing a code stage with C# or VB to convert text to collection

sample Input:

1.The capital of India.

Moscow

#Delhi

Kabul

Tokiyo

2.The capital of Japan.

Moscow

Delhi

Kabul

#Tokiyo

3.The capital of Afganistan.

Moscow

Delhi

#Kabul

Tokiyo

4.The capital of Russia.

#Moscow

Delhi

Kabul

Tokiyo

Output

468.png



------------------------------
Rajsudhapriya CN
------------------------------
2 REPLIES 2

Hi,

Did you try to do the same using native BP functions and utilities?



------------------------------
If I was of assistance, please vote for it to be the "Best Answer".

LinkedIn - https://www.linkedin.com/in/tejaskumardarji/

Thanks & Regards,
Tejaskumar Darji
Sr. Consultant-Technical Lead
------------------------------

MichealCharron
Level 8

@RajsudhapriyaCN 

As @Tejaskumar_Darji has pointed out, you should always try to use the BP VBOs instead of building code for very specific tasks. Even if you need to build code into your objects, the code should be generic enough that it is reusable throughout your processes.

For the above data, you could use the Blue Prism "Utility - Strings" VBO (Blue Prism Digital Exchange - Utility - Strings). In it is an action called "Extract Regex All Matches" that you could pass the following Regex pattern:

(?<Question>.+)[\r\n]+(?<Option1>.+)[\r\n]+(?<Option2>.+)[\r\n]+(?<Option3>.+)[\r\n]+(?<Option4>.+)[\r\n]*
This action:
463.png
Will give you these results:
464.png
You could even use the "Delete Field" action in Blue Prism's "Utility - Collection Manipulation" VBO to remove that "Full Match" field.


------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
Micheal Charron
RBC
Toronto, Ontario
Canada