Avatar of waddhah
waddhah
 asked on

What the opposite Function to MID()

Mid(text,2) will select the first 2 characters ,, I want to select the last characters
Visual Basic.NET

Avatar of undefined
Last Comment
isproca

8/22/2022 - Mon
isproca

Hi waddhah,

AnyString = "Hello World"

MyStr = Right(AnyString, 6)    ' Returns " World".

Heres the msdn link

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ca808da5-85e2-49c3-8abe-d66f2dc92f9d.asp
Hope this helps


Cheers!
ASKER CERTIFIED SOLUTION
Fernando Soto

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
waddhah

ASKER
isproca,
 
Thanks for helping , but there is no such a function call Right in vb.net .
waddhah

ASKER
thanks .
Your help has saved me hundreds of hours of internet surfing.
fblack61
Fernando Soto

hi waddhah;


To do it like isproca posted you will have to import Microsoft.VisualBasic or write it this way

      MyStr = Microsoft.VisualBasic.Right(AnyString, 6)   ' Returns " World".

To to it the .Net way, do it like this

      Dim LastToChars As String = AnyString.Substring(AnyString.Length - 6) ' Returns world
      Where - 6 is how many character to select

Fernando

     
isproca

waddhah,
Sorry, I didnt see the .NET I just saw VB.  My appologies!!