Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    New York
    Posts
    160

    Unanswered: String Manipulation

    I got a string for example
    "C:\winnt\system32\logo.jpg" (with the quotes)

    all i need is logo.jpg

    how can i do this ?

    i am thinking of dumping it to an array and getting rid of everything before last \ or / (windows works both ways)
    and getting rid of last quote -

    if this is a good way how do i do that ?
    if there is a better / easier way, please let me know.

    Thanks
    Beyond Limitation

  2. #2
    Join Date
    Jan 2003
    Location
    de/ro
    Posts
    12

    Re: String Manipulation

    Originally posted by vextout
    I got a string for example
    "C:\winnt\system32\logo.jpg" (with the quotes)

    all i need is logo.jpg

    how can i do this ?

    i am thinking of dumping it to an array and getting rid of everything before last \ or / (windows works both ways)
    and getting rid of last quote -

    if this is a good way how do i do that ?
    if there is a better / easier way, please let me know.

    Thanks
    try this:

    FUNCTION getFileName( strPath )
    IF strPath <> "" THEN
    strPath = Replace(strPath, chr(39), "") 'removing the double quotes
    temp_array = Split(strPath, "\") 'splitting the string by \ into temp_array
    getFileName = temp_array(UBound(temp_array)) ' getting the last item from the array
    ELSE
    getFileName = ""
    END IF
    END FUNCTION
    Last edited by wakhy; 04-10-03 at 11:35.

  3. #3
    Join Date
    Jan 2003
    Location
    New York
    Posts
    160
    thnx,

    nice coding
    Beyond Limitation

Posting Permissions

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