Hi all,
i’m just studying a case of data manipulation, i’ve seen this 3d.
I just want to understand why this string is correct.
text.Substring((text.LastIndexOf(“Start”) +5), (text.IndexOf(“end”) - (text.LastIndexOf(“Start”) +5)))
to obtain get this text form this string
“words
Start words
Start Get This Text
End
End”
If you can explain the logic behind the data manipulation
Thanks
Having that into account Substring(initial position,substring length)
LastIndexOf(“Start”) gives you the initial position of the last occurrence of “Start”, but you need the final position, therefore you add 5.
IndexOf(“end”) gives you the initial posistion of the first occurence of “end”. With the operation you are calculating the length of the substring you are looking for.
Substring((text.LastIndexOf(“Start”) +5), (text.IndexOf(“end”) - (text.LastIndexOf(“Start”) +5))) = Substring(16,14) = Get This Text (with a white space at the end)