Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a certain amount of characters from a string

Status
Not open for further replies.

tehCoosh

Technical User
Aug 29, 2005
9
US
Im trying to have my application read only a certain amount of characters from a string. So lets say 'str' is 5 characters long, and I only want to read the last 2.

Thanks in advance :)
 
Take a look at Right$, Left$, Mid$ functions in your VB help.
 
This would return the left two characters of the old string:

newstring = left(oldstring, 2)

This would return the right two characters of the old string:

newstring = right(oldstring, 2)

This would allow you to start somewhere other than the left or right. For instance, the one below will start at character #2 and read 3 characters to the right of it.

newstring = mid(oldstring, 2, 3)

Hope this helps.

Shannan


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top