Extract specif data from variable

Hi All,

I have a variable type String as screen below:
image

I would extract the value to “Date”.

I try with this method:

clientDetails.Substring(clientDetails.IndexOf("Date ") + "Date: ".Length).Split(Environment.NewLine.ToCharArray)(0)

Any suggestion?

Thank you!!!
Regards

Hi @salvatore.quimi
We can achieve this using regex

Thanks,
Robin S

if you are holding that string in a variable lets say - Text

use a array var lets say SubString

assign SubString = Text.Split(":"c)

this will give date SubString(4).ToString

hope this is helpful

Hi @salvatore.quimi

create one string variable for date Ex:Out_Str

Put the below syntax in assign activity

Out_Str=System.Text.RegularExpressions.Regex.Match(Your_Input_String,“((?<=Date:)[\d-]+)”).Value

Date will be stored in Out_Str variable

Hope It solves your issue

Thanks
Robin

Hi @Robinnavinraj_S ,

Your method is fine but for Acme exercises I can give this information:

For the TAXID → I used this method and it worked:
outputVar = clientInformation.Substring(clientInformation.IndexOf("TaxID ") + "TaxID: ".Length).Split(Environment.NewLine.ToCharArray)(0)

I tried the same method to catch the value of date but not work
Could you support?

Thank you

Hi @salvatore.quimi
If you want split method

You can also put it like this

OutStr=YourInputString.Split(":"c).Last

Hope it solves your issue

Hi @salvatore.quimi

Is your issue resolved ah ??

hi @Robinnavinraj_S

finally I solved with this method:
clientDetails.Substring(clientDetails.IndexOf("Date ") + "Date: ".Length).Split(Environment.NewLine.ToCharArray)(3)

Thank you for your support!

Regards

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