I am trying to trim a session variable to get the last three characters.Here is the code:
Dim CancelTrim()AsChar = {"","cc9"}
If Session("confirm").trimend(CancelTrim) ="ca1"Then
Label1.Text ="it was cancelled"
EndIf
It's not working though, go figure. So, how would I get these to trim off the last three characters so I can do what I need to do?
Thanks
Hello,
so what does it return from ther TrimEnd call? TrimEnd trims from the end of the string, so isn't that from the wrong direction if you want the last three characters? So maybe TrimStart would work better?
On the other hand, couldn't you write something like:
Dim ConfirmStringAs String = Cstr(Session("confirm"))Dim LastThreeCharsAs String = ConfirmString.Substring(ConfirmString.Length - 3)If LastThreeChars ="ca1"Then'CheckEnd If
0 comments:
Post a Comment