Split Activity

Hi,
How can I use split activity with more than 1 separator? I have some data in an excel sheet, where in some rows the separator is “at” and at some places “AT” . I need to split the column. I tried using 2 different split activities, but not working.

Hi,

You can use split like this;

Split(str_test,“AT”, ,Microsoft.VisualBasic.CompareMethod.Text )

Hope it helps!

1 Like

Thank You, but i am an amateur and very new to UIpath. Can you tell me what’s str_test supposed to be here?
and also, I need to use both separators, at and AT . Is it possible to use in one statement?

str_test has to be your data which we will split. You should read that excel, put dt in a for each row. Then row(0).toString or whatever your column index will be your str_test.

And this will solve at or AT situation;

Split(str_test,“AT”, ,Microsoft.VisualBasic.CompareMethod.Text )

2 Likes

Thank you so much. It worked ! So basically, Microsoft.VisualBasic.CompareMethod makes the string case insensitive?

And I have one more question,
So the said Excel where I need to split, if part one is data, and second part is Null. Then what can I do?
For eg. Data in cell is → Developer at Google.
DBM
HR at Workday
Now, for 2nd row after splitting, 2nd part should be left empty and continue with next row. But it is giving error “Index out of bounds”
I’ve tried putting If condition , but not working. Works well until that DBM row. Any suggestions?

Can you share your error screenshot please?

What are you doing after split by the way?

excel screenshot

So currently I’m trying to split these columns. First column was seperated in - first name and last name.
second column is supposed to be separated by title and company. In some cases there is only title, no company, in those particular cases it is giving me error,
I tried using if condition, not working.

Hi,

In if condition use this;

TempDT_Arr.count<2

For true part make Company_Column=“”

Can you try that?

1 Like

Yes!! It worked. Thanks a ton :grinning:

You’re welcome :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.