Hi Everyone,
i have a text
Text123.txt (4.1 KB)
i want to get each line last sentence before and after “,”
For Example ,
one line
,○,○,○,○,22,LABEL TAPE,----------,9S6-7010,1,PAPER ,PRODUCTION CONTOROL LABEL,
PRODUCTION CONTOROL LABEL
Thank you!
Hi Everyone,
i have a text
Text123.txt (4.1 KB)
i want to get each line last sentence before and after “,”
For Example ,
one line
,○,○,○,○,22,LABEL TAPE,----------,9S6-7010,1,PAPER ,PRODUCTION CONTOROL LABEL,
PRODUCTION CONTOROL LABEL
Thank you!
Split the string with , and get the second last index value.
strOutput=strInput.Split(",")(strInput.Split(",").Count-2)
Output:

Thanks,
Ashok ![]()
textBeforeLastComma = inputLine.Substring(0, inputLine.LastIndexOf(",")).Substring(inputLine.Substring(0, inputLine.LastIndexOf(",")).LastIndexOf(",") + 1).Trim()
textAfterLastComma = inputLine.Substring(inputLine.LastIndexOf(",") + 1).Trim()
Regards,
lines = fileContent.Split({Environment.NewLine}, StringSplitOptions.None)
For Each line in lines
lastCommaIndex = line.LastIndexOf(","c)
beforeLastComma = line.Substring(0, lastCommaIndex).Trim()
afterLastComma = line.Substring(lastCommaIndex + 1).Trim()
Hi @victoryv4569 ,
Could try with the below Expression as well :
Split(strText.Trim(",".ToCharArray),",").Last.trim
From Debug :

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.