Remove last character
I am trying to remove a string which last character is either "--" or "-" ... I can only get "--" work ... but not "-" ... My code as follow:-
===================
sISBNNode.text = Left(sISBNNode.text, 1) & "-" & Mid(sISBNNode.text, 2, 6) & "-" & Mid(sISBNNode.text, 8, 2) & "-" & Mid(sISBNNode.text, 10, 1)
'This works
if Right(sISBNNode.text, 2) = "--" then
sISBNNode.text = replace(sISBNNode.text, right(sISBNNode.text, 2), "")
end if
'This is not working, it replace ALL the "-" with "", not just the last "-"
if Right(sISBNNode.text, 1) = "-" then
sISBNNode.text = replace(sISBNNode.text, right(sISBNNode.text, 1), "")
end if
|