Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > String Manipulation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-03, 09:24
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
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
Reply With Quote
  #2 (permalink)  
Old 04-10-03, 11:33
wakhy wakhy is offline
Registered User
 
Join Date: Jan 2003
Location: de/ro
Posts: 12
Re: String Manipulation

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

Last edited by wakhy : 04-10-03 at 11:35.
Reply With Quote
  #3 (permalink)  
Old 04-10-03, 16:31
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
thnx,

nice coding
__________________
Beyond Limitation
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On