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!

How to remove last character of a string?

Status
Not open for further replies.

speek

Technical User
Mar 29, 2008
25
0
0
US
How to remove the last character of a string (of unknown length)?

Explanation:
The user selects a path. The program adds a backslash at the end of the path. But in one case this backslash must be removed.

Speek
 
Hi Speek,

Dim str As String
Dim intA As Integer
str = "aaaaaaaaab\"
intA = Len(str)
str = Left(str, intA - 1)
Debug.Print str

Jon
 
...or perhaps
strNewString = Left(strOldString,Len(strOldString)-1)
 
I tried Brian's solution and it works fine. Thanks to both of you.

Speek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top