Extract s string after collan :

I want to extract a string after a : which is excel

example:
input
uipath:is a RPA tool

output should be:
uipath(in one column)
is a RPA tool (in second column)

what i tried is a am using for each row in a excel preceeded by below image but am getting error has array out of bound exception.

image

Hi,

Can you try the following?

val3 = Split(val1,":")(1)

Regards.

above i tried at val3 assign activity but same error array out of bound

Just pass your value through a Split as follows and assign result into a String array
arr_SplittedWords= Split (val1,":")
now you can add values into different columns using array items like below
let say assigned array as arr_SplittedWords
val2 = arr_SplittedWords(0)
val3 = arr_SplittedWords(1)

Note: delimiter will be removed in Split function

Hi @Karthik_Kulkarni,

I can see in your screenshot that you you’ve used, —> val3 = Split(val2,":")(1).ToString
instead of that you should split val1 like this —> val3 = Split(val1,":")(1).ToString

Because…
Now, val2 holds —> uipath, so there’s no colon in it to split with and that’s why you’re getting specifying array out of bound exception.

So, make this small change, in assign of val3, split val1. —> val3 = Split(val1,":")(1).ToString

Ttried above everything still getting same error at val3(array out of bound)

actually in my input sometimes collan will not be there example as below
input:
abc PO # 3y678
def PO # 4r567
ghi PO # 52RN7AZE
Re: SPNA PO # 12345
Re: SPNA PO # 9u789
Fw: karthik po #hjhk

In the above sometimes we have :in some rows we dont have collan.I want to get the string after collan in anew coulmn

SolutionSequence.xaml (10.4 KB)

Attached is the solution for , using regex expressions. Please let me know if you have any questions.

Where I have used readRange activity to read the input data from the excel(from your post#1)
Output data is in a datatable named as dt .

i know why you are getting error when you try to split string with “:” character.

When you want to split a string, program gives you a array of splitted text.
For example=> myString = abc:def:gfh => myString.Split(":") = {“abc”,“def”,“gfh”}

After using Split method you are trying to get first variable(which means index 0) and get second variable(which means index 1).

If your string has no “:” character, program gives you a one-element array.
For example=> myString = abc => myString.Split(":") = {“abc”}

You are getting out of bound error because there is no second element(index 1).

You need to control your splitted array element count, before you assign.

Sincerely,
Erkan Ceylan