Quote:
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