Robotics
(Bala)
October 21, 2019, 8:29am
1
HI TEam,
I have a line say
ABCD EFGH POSTAL CLASS 1
Bot has to ignore POSTAL CLASS 1 and should extract every thing which before the word POSTAL.
Output should be - ABCD EFGH . Values before POSTAL may increase or decrease say 1 word, 2 or 3 words also…
sarathi125
(Parthasarathi)
October 21, 2019, 8:36am
2
@Robotics ,
Considered that you are passing your string with strInput variable.
Then try with the following line of code, this will help.
strInput.Substring(0, strinput.IndexOf("POSTAL"))
@Robotics
str = ABCD EFGH POSTAL CLASS 1
Below 2 methods will gives you required result.
str.split({“POSTAL”},StringSplitOptions.RemoveEmptyEntries)(0)
Split(str,“POSTAL”)(0)
Robotics
(Bala)
October 21, 2019, 9:29am
4
@ Sarathi your code is working fine.
@ Manjuts thanks for your update as well.
1 Like