Extract a string after many spaces from its anchor

I am trying to extract subtotal, tax and total from a text variable, but there are spaces between the colon and the value while I have other invoices that the value is right after the colon (:)sign and I am using (strInvDetails.Substring(strInvDetails.IndexOf("Subtotal: ") + "Subtotal: “.Length).Split(Environment.NewLine.ToCharArray)(0).Split(” "c)(0)) to extract the data. Help please


@Amr_Nweery ,

Can you Try this

Subtotal = Split(Split(YourStringVar,“Subtotal:”)(1),Environment.Newline)(0).Trim

Tax = Split(Split(YourStringVar,“Tax:”)(1),Environment.Newline)(0).Trim

total = Split(Split(YourStringVar,“Total:”)(1),Environment.Newline)(0).Trim

Regards,

Keeps getting me this error

Hi @Amr_Nweery ,
This error usually occurs when you use ” instead of ". Make the necessary changes and try to run again :slight_smile:

i don’t understand

Use the straight quotation mark instead of curved

Straight-> "
Curved-> ”

@Amr_Nweery ,
is it Working now?
If not can you us the Screeshot of your assign activity?

Regards,