The Daily Click ::. Forums ::. Klik Coding Help ::. Select a part of a string
 

Post Reply  Post Oekaki 
 

Posted By Message

7Soul



Registered
  12/08/2008
Points
  167
11th August, 2010 at 22:28:33 -

I have a string that is the path of a file, something like "C:\folder\file.png", and i want to remove everything but the file name "file.png"

PS: im getting the file path using the "Explorer" extension, and it only returns the full file path, but i want only the file name

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
11th August, 2010 at 22:43:24 -

Do you know how long the filename will be? If you do, you can use the "Get right sub-string" function under the special object. It makes this: Right$(>Enter string<, >Enter number of characters< ) Pretty self explanatory.

If you don't know how long the filename will be and you don't know what the file will be called, you'll probably need to use a string parser and set "/" as a delimiter. Have you ever used one of those before?

 

  		
  		

7Soul



Registered
  12/08/2008
Points
  167
11th August, 2010 at 22:53:10 -

2nd opition
I tryed to use the "String Parser" extension but i dont know how to use it

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th August, 2010 at 00:50:32 -

The easiest way is using the Quick Token Extension.

eg:
GetToken$( "Quick Token Object", "C:/folder/file.png", "/\", GetNumberToken( "Quick Token Object", "C:/folder/file.png", "/\")-1)

 
n/a

7Soul



Registered
  12/08/2008
Points
  167
12th August, 2010 at 02:27:25 -

That worked, thx Sketchy!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click