Please explain function of each keyword in this string manipulation command

text.Substring(text.IndexOf("TaxID: ")+"TaxID: ".Length).Split(Environment.NewLine.ToCharArray)(0)

Here text is the entire text you have @Gaurav07,

Indexof gives the starting index of the TaxID , I mean, the starting character position,

TaxID length represents the number of characters in the string TaxID… So,

we are giving the index as the starting of TaxID + length of TaxID , so it will start with the actual value we need.

Then split (newline) represents to split the text upto the next new line character and then (0) represents before the new line. If we give it as (1), it will gives us after the new line

Hope this is very clear @Gaurav07

4 Likes