the watch Panel in Uipath Studio is showing a wrong output value after treatment of a string variable.
example
string variable message=“You searched for author Mark Twain. His books can be found in the following stores: Bookland,Classics bookstore.”
try this: message.Substring((message.LastIndexOf(“author”) +6), (message.IndexOf(“.”) - (message.LastIndexOf(“author”) +6)))
Or you can just add +6 at your expression.
LastIndexOf and IndexOf always identify the word “author” from index 0, so you must increment the index (+6). LastIndexOf is if you have more than one word “author” in your sentence, not your case, so no difference.
Try to change the indexOf(“.”) with LastIndexOf(“.”) for a better understanding, in this case, you have two points in your sentence, so the result will change
many thanks for your support, your solution works.
now I know that LastIndexOf and IndexOf identify a word “xxxx” from index 0, so I must increment the index (+[word lenght])