beber005 wrote:I was testing your program
Presumably you are referring to Declan's code in the 5th post, as opposed to yours. Which, we have apparently established, is all that you need to do if you do already know how many characters need to be removed in each case. Though again it would (generally) be far more efficient to have them removed from the data source.
beber005 wrote:and it works but it returns to me, at the end of the expression a slah (/).
Yes it does.
beber005 wrote:But I don't want this character and I don't arrive to delete it in your code. I think I have just to put a minus 1 but where ? I don't find the solution.
Seriously? You've
read the documentation on SubSt, and you don't get what Declan's code is doing?
Declan's code is counting back from the last character position in the string.
Consequently when sChar hits a \ character, counting down from the full string length, iChar is telling you what the
position of that character is in the string.
In your example, with the character numbers shown underneath:
Code: Select all
N/ABFG/P/1011
0000000001111
1234567890123
The last slash is at character number
*9*. His code has counted back 13 (the last character in the string, not a slash), 12 (not a slash), 11 (not a slash), 10 (not a slash), 9 (Eureka, it's a slash).
The code
is extracting the first how many characters from the original string?
The first
*9* characters, the value of the iChar variable. That will of course include the 9th character which, as we established above, is the slash.
Given all of that, could you perhaps make an educated guess as to where you need to subtract 1 to exclude the slash?
beber005 wrote:I'm so sorry for this lost of time

The colloquialism that you're looking for is actually "waste of time".