Results 1 to 4 of 4

Thread: Simple Trimming Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Simple Trimming Question

    I need to trim everything preceding the last / in a string. for example if the string were "C:\Files\New\program.exe" all I want is the "program.exe portion.

    How would I go about doing this

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: Simple Trimming Question

    if you want this to get file names you can use
    vb Code:
    1. io.path.getfilename(fname)

    otherwise something like this will work

    vb Code:
    1. s = mystring.substring(mystring.lastindex("/"))

    or something like that
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Re: Simple Trimming Question

    thank you

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Simple Trimming Question

    Hey,

    When it comes to files and file paths, there are a number of methods available that replace the way things used to be done, i.e. with substring. GetFileName is just one of them.

    You can see them all here:

    http://msdn.microsoft.com/en-gb/libr...h_members.aspx

    Hope that helps!!

    Gary

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