Using Substring read subject mail

I want to find value from below string. Can any one help me in this

Input : Report from ABC period January

I want output like this: : value 1 = ABC and value 2 = january

@fairymemay If the Format of the String is Always in the Same Format, Then We can use Substring or Split methods to get the Values

1 Like

@fairymemay

Split the string to get the required values.

Below is the UiPath code assuming that “Report from” and “period” will be fixed.

Assign : InputString = “Report from ABC period January”
Assign : InputStringSplit = InputString.Split({“Report from” , “period”} , StringSplitOptions.None)

Variable Type of “InputStringSplit” must be Array of [String]

Assign Value1 = InputStringSplit(1)

Assign Value2 = InputStringSplit(2)

1 Like

Can you tell us more about your work flow like variable types?

@manishjagtap @majeed567

image

strStart = String
final = Sting
value1,2 = string

@fairymemay

Are you getting the below exception ?
System.IndexOutOfRangeException: Index was outside the bounds of the array.

Can you provide the entire screenshot of what you are assigning to the variables “final” and the value of “strStart”

@manishjagtap

image
ื
and now it can’t split from mailsubject…

In subject email : Report from ABC period January
It alert : ABC period January

If the input is in same format then the solution provided by @manishjagtap works perfectly. Check if input is in same format and also provide the output screenshot

1 Like

@fairymemay

For analysis, the actual value of the variable strStart would be required.
i.e the actual string value of mailsubject that was assigned to the variable strStart.

Along with this the keywords that you are using to split would also be required.
In the screenshot only strStart.Split({ "Co is visible. Can you provide the entire split keywords you are using.


For the question :
and now it can’t split from mailsubject…
In subject email : Report from ABC period January
It alert : ABC period January

Are you providing the keyword “period” while splitting the string?

Can you share your workflow?

@manishjagtap
thank you
i can solved it now.

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