Hello, I how do I find the last but one character in a string in VB.net.
for e.g. I have a string Dim strTicket as string="56789-091F0" I want the value "F"
Thanks for your help in advance.
Hello, I how do I find the last but one character in a string in VB.net.
for e.g. I have a string Dim strTicket as string="56789-091F0" I want the value "F"
Thanks for your help in advance.
have a look at .Substring()
method: http://msdn.microsoft.com/en-us/library/system.string.substring.aspx
Dim strTicket as string="56789-091F0"
Console.WriteLine(strTicket.Substring(strTicket.Length-2,1))
Check that your string is long enough before doing this tho!!
Just select it as you would the next to last element of an array. I don't see the need for all the extra stuff.
Dim newChar As Char = strTicket(strTicket.Length - 2)