Click to See Complete Forum and Search --> : Strip "\" on End


aussiecyclone
April 2nd, 2001, 11:56 PM
Hi,

I lost this line of code someone on this forum gave me. I want to strip the last "\" from the line below.

C:\MyDir\MyFile\

Any help appreciated.

Regards,

Alan.

cksiow
April 3rd, 2001, 12:52 AM
dim s as string
dim t as string
dim l as long

s = "c:\mydir\myfile\"
l = instrrev(s,"\")

t = mid(s,1,l-1)

t should got "c:\mydir\myfle"

hope this help.

cksiow
http://vblib.virtualave.net - share our codes

Iouri
April 3rd, 2001, 07:13 AM
YourString = "c:\...\"
if right(YourString,1) = "\" then
YourString = left(YourString,len(YourString)-1)
end if

Iouri Boutchkine
iouri@hotsheet.com