I have the following string.
"<This is my string=NHUYT>"
I would like to get words between "="
and ">"
but I would like to make this generic, not for only this word NHUYT.
Using substring I tried:
var line = "<This is my string=NHUYT>"
var index = line.Trim().IndexOf("=");
var lastIndex = line.Trim().IndexOf(">");
var id = line.Substring(index, lastIndex);
But I can't do that because lastIndex
is actually the length, so how can I do this?
Substring(Int32, Int32) Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.