Right(string)

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
 
R

Raterus

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

Microsoft.VisualBasic.Right("blah", 2)
 
B

Brian Shannon

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)
 
R

Raterus

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top