How to Seperate Array of string with SWITCH

Hi…

i want to seperate this Array of string { Ax001, ax002, aX003, Bx001, bx002,bX003 , Cx001, cx002,cX003}

But i can’t figure out the .Net Expression to seperate this through switch activity.

Hi @Bhagyaraj_Digumarthi ,

Could you let us know what exactly do you mean by separate ?

Could you provide us with examples ?

Hi @supermanPunch i

i wanna seperate those Array of strings Based on their two initial to Alphabets.

@Bhagyaraj_Digumarthi ,

If that is the case, you could use Substring operation on the item variable like below :

item.ToString.Substring(0,2)

Thanks, @supermanPunch

But what is the logic behind(0,2) if we are using index numbers then we are supposed to use (0,1)
right?

why (0,2)? what’s the logic behind it?

we can do it dynamic without switch:

Assign Activity:

ListOfGroupArray | List(Of String()) =
YourArrayVar.GroupBy(Function (x) x.Substring(0,2).toUpper).Select(Function (g) g.toArray()).toList

it will return a list of String Array. Each klist item contains the array with the split items belonging to a particular group

@Bhagyaraj_Digumarthi ,

You could Check the Syntax of the Substring as well in Studio :
image

Basically, First parameter is the index from where the String should start, the second parameter is the number of characters to be taken from the starting index.

Thankyou so much.

1 Like

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