CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2001
    Posts
    29

    Strip "\" on End

    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.


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: Strip "\" on End

    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



  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Strip "\" on End

    YourString = "c:\...\"
    if right(YourString,1) = "\" then
    YourString = left(YourString,len(YourString)-1)
    end if

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured