Right(string)

  • Thread starter Thread starter Brian Shannon
  • Start date Start date
B

Brian Shannon

Is there a VB.NET function to find the right most characters of a string
similiar to Microsoft.VisualBasic.Right?

I am currently using the below code to find the right most characters and am
wondering if there is a more efficient or better way to do the same.

dim x as string
dime y as string
dim lastIndexof as stirng
x = New StringBuilder(WhereFunction)y = x.Length

lastIndexof = x.ToString.LastIndexOf(" ")

If y = lastIndexof Then

y = y

End If
 
Right() still can be used, infact you don't even need to be using VB.net

Microsoft.VisualBasic.Right("blah", 2)
 
Thanks for the quick reply. I know that Microsoft.VisualBasic.Right can
still be used but I just assumed there is a more effecient way of doing it
with with the string functions or stringbuilder class.

Just curious if there is another way?

Thanks Raterus
Right() still can be used, infact you don't even need to be using VB.net

Microsoft.VisualBasic.Right("blah", 2)
 
You can basically achieve the same effect using substring

Dim blah as string = "here is some string"
Dim newstring as string = blah.Substring(blah.Length - 5)

At this point newstring = "tring"
 
Back
Top