Extract values using Substring



Hi all,

I am a beginner to RPA. I want to Extract some values using Substring.

ID: 001
Brand: Shirt
Size: S
Color: Blue

I want to get only below values separately. >>

Can anyone help me ??
Thanks in Advance :slight_smile:


Hey @savithrin

Refer below thread and u will be able to get some idea about it.

if still will face problem, Let us know.




Check attached File

SubstringRemove.zip (1.9 KB)


Hi ,
Thanks for the help. But now i am facing another problem.
In my case I am getting above mentioned data from a PDF using read PDF text. variable name = pdf1.

test1_id = Split(pdf1.ToString , “:”)
output = test1_id(test1_id.Length-4)

When I print the output variable, it shows the value as this.

Can any one help me :roll_eyes:


you have to split first your string with Newline then you will be able to use what you have done.



The thing is am getting those data from a pdf. So I think I cant use your method. Anyway thanks for the great help :slight_smile:


Can you tell me how to to that :roll_eyes:


Hi @savithrin,

StrValue=" ID: 001
Brand: Shirt
Size: S
Color: Blue"

ArrNewline-> string[]
ArrNewline=StrValue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

Use for each activity

Push the value into Dictionary
Key=arrValue(0) and Value=arrValue(1)


dictPromoData(“Brand”) -> you will get the value as “Shirt”
Refer this post



Nice example.
Don’t forget to add .Trim calls or change Split(":"c) to .Split(": ") (without c qualifier, as then we’re splitting by actual string, not char) , otherwise you’ll have leftover whitespace in the values (and possibly keys as well, depending on original string).

PS. You’re adding a lot of code to the forum, it would look better and be safer (and easier to copy) if you’ll put them in code tags or backticks.


Substring sample.xaml (8.2 KB)

String manipulation - read all words between two hashes ##

thanks all now it works perfectly :smiley: