Split string

Heather Rowe
440-836-7702-this is phone no
MPP- this is company name
31005 SOLON RD
SOLON, OH 44139-3436

hello guys i need a help
this is string in which phone no company can swap
so how can i make sure the robo picks and phone no and company name
thanks
arjun

If your string is separated by new line its quite simple.
use:
yourText.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries) and assign to a array of string type variable.

Then use index, arrayVar(1) and arrayVar(2) and you will get your result.

but sometimes phone NO and comapny name are swap
for eg phone comes on 3rd position and and company name on 2 position in that how can i do??

Ok, then you can match the value using reg ex.
pick arrayVar(1) and arrayVaR(2)

Use the activity “IsMatch”,
Input: arrayVar(1).toString
Pattern:“\d{3}(-?)\d{3}(-?)\d{4}”
Output: boolean value.

Check if that’s true or false. If it’s true, its a phone number.
Else the companyname

its done but and i get the ans too but when phone comes on 3rd place robo picks company name as phone no

What does your condition structure look like?

Can you put a screen or a pseudo code of what you are doing in this case?

Hi @arjun27,

So can you provide the possible inputs and your expected output from that.

Regards,
Arivu

image

Heather Rowe
440-836-7702
MPP
31005 SOLON RD
SOLON, OH 44139-3436

Heather Rowe
MPP
440-836-7702
31005 SOLON RD
SOLON, OH 44139-3436

if phone no comes on 3rd position in that case how can i do

Hi @arjun27,

Use matches activity to get the matched record from the string

Use the below pattern
\d{3}-\d{3}-\d{4}

Regards,
Arivu

i have upload an ss of excel in which it shows phones no comes in company name
position of phoneno and company name is not fixed ??

Im not sure, but i created a similar seq and it works well

can you share it pls

matchString.xaml (6.9 KB)

city_location.xaml (245.1 KB)
test1211.xlsx (8.3 KB)

1 Like

i have share my flow as well excel too
and i have attached ss of the output
can u pls check sir
Thanks
arjun

@arjun27 i have fixed your sequence for switch case where length is 5 and now output is as expected.
I have tested both scenarios and it switching between phone and address.

Check city_location.xaml (245.6 KB)

You can do for the rest of the cases.

Issue.
In your Matches activity, split and the use the particular element only, you have passed whole string so it will alwaz give you a match as phone is part of the string.

hi i got the output can u tell me where u made the change pls
thanks sir
regards arjun

1 Like