How to Split a String

i do read from the excel sheet with different values and finally, I will get this expression “Please take note of your order reference: ???”. i have used split string activity to split like this “Please take note of your order reference:” “???” and finally i want to write this “???” into the excel while writing in excel it displays “system.string” instead of “???” this value.

Hi @VASUDEVGUTTIKONDA,

You can get in 3 ways.

  1. Replace string

StrValue=StrValue.Replace(" Please take note of your order reference:","")

2.using regex you can get the value.
If suppose your ??? Value is number.
StrValue=System.Text.RegularExpressions.Regex.Match(StrValue, "[0-9]").Value

  1. Using substring also you can get the value.

StrValue=StrValue.SubString(StrValue.Length-3)

Regards,
Arivu

3 Likes

Hi Team,

I have a requirement where, uipath will read the Excel File and based on that will enter the data in a web-based banking application.

On the application side, there is table of products which I am not able to scrap because it is “table inside table”.

ProductList

Hence I am using Get Full Text Activity to take the records from the grid and it is coming like this:


0100601006 - Current Accounts One Tarrif Premium - Retail: PremiumKES

O
0200602006 - Current Accounts One Tarrif Premium - Retail: PremiumUSD

O
0300603006 - Current Accounts One Tarrif Premium - Retail: PremiumEUR

O
0400604006 - Current Accounts One Tarrif Premium - Retail: PremiumGBP

In the excel file only five digits will be mentioned e.g. ‘01006’.

Need to split the first five digits and based on entry in excel need uipath to select the product.

Please help.

Thanks

Hi @thepathbreaker,

strValue="0100601006 - Current Accounts One Tarrif Premium - Retail: PremiumKES"

ProductId=strValue.SubString(0,5)
Desc=strValue.Substring(5,strValue.Length-8)
Currency=strValue.Substring(strValue.Length-3)

Regards,
Arivu

4 Likes

Thanks for the quick reply @arivu96

As you can see ‘✓’ and ‘O’ are also coming while Getting Full Text. How can we get rid of that. So that my string will come like this:

0100601006 - Current Accounts One Tarrif Premium - Retail: PremiumKES
0200602006 - Current Accounts One Tarrif Premium - Retail: PremiumUSD
0300603006 - Current Accounts One Tarrif Premium - Retail: PremiumEUR
0400604006 - Current Accounts One Tarrif Premium - Retail: PremiumGBP

Hi @thepathbreaker,

So you will get the string from the string you can split using Environment.NewLine to split the each row.
out put seem like ‘✓’ and ‘O’ is coming in superate line so if its come skip.

Regards,
Arivu

Hi all,
I have a similar Problems but could not find a solution so far.
I have a text “The Number is 123456. Thanks” but I just need the expression “123456”.
Of course, the numbers are unique so I can not just search for it but the text is always the same.

Hi @tomatosoup,
input->string
input=“The Number is 123456. Thanks”

input = Regex.Replace(input, "[^0-9]+", string.Empty)

Regards,
Arivu

3 Likes

Sorry; I can not follow :(.

I have done the following:

  • Creating two String Variables: “Text Request” and “AccessNumer”
  • “Get visible text”-activity
    → getting the text
  • “Assign”-activity
    → AccessNumber=Split(Split(TextRequest,“Document”,10)(1)," ")(1).Trim

Hi,
How to use " as a delimiter in String Split option

1 Like

Hi @Divakar_Sundaram,

strvalue= "How to use "" as a delimiter"

arrvalue=strvalue.split(""""c)

arrvalue(0).Tostring ->How to use

Regards,
Arivu

Hi arivu96,
thanks for the reply.
The case i have is as below
strvalue= How to use " as a delimiter"

Yes @Divakar_Sundaram, the string values is in between the double quotes right so i givien like that.

If you print the string value you will get the value as How to use " as a delimiter" only.

implement the logic.

Regards,
Arivu

1 Like

Hi @arivu96,

It helped to resolve my issue but i got an another case in the same. If am using this in case if the body contains any other numbers it’s giving those numbers as well.

For example I got a mail response like the below Mail in other words a response mail then the result for this is “2385927841620181021238592784” can you please help me to improve the Split function.

Thanks in Advance!!!

Mail Body:

Hi Team,

We have processed the whole application and got the PO number the current number is PO: 238592784.

Regards,
Prasanth

From: MailAddress
Sent: Wednesday, May 16, 2018 10:21 PM
To: MailAddress
Subject: Resultant OPO

Hi Team,

We have processed the whole application and got the PO number the current number is PO: 23859278.

Regards,
Prasanth

Hi @Prasanth_kolla, take a look at this .xaml, I hope it could help you.
test.xaml (6,8 KB)

Result
imagen

2 Likes

Hi Divya,

I need small help regarding converting data from PDF file to csv with the proper format.

Can i have any class file related to that.

When i try to run that script . the csv file has generated but the data is not in proper format.

if u want i will send the PDF file along with that class file and excel file also.

yes please attach the file i will look into it and will get back to you:)

HI Divya,

Please find the attached pdf file and excel file.

IN excel file given data as we need as same format of information displayed in pdf.

So we need to convert that pdf data in to csv file by using that information.

Thanks for your suppport in advance…

Participant_CMCLudhiana.pdf (793 KB)

FD_Data in Excel.xlsx (1.27 MB)

It seems UI Path uses the .Net framework and these standard functions don’t work as you expect them to do in Python for example. You can view their documentation here for split function: https://msdn.microsoft.com/en-us/library/system.string.split(v=vs.90).aspx

try using this PDFVariable.Split({“not”},StringSplitOptions.RemoveEmptyEntries)