c# - Remove file type from string -


this question has answer here:

i'm calling list of strings server.

at moment i'm getting full name , file extension like:

image1.jpg

image2.png

test_folder.folder

i have code relies on knowing extension is, need access name of item i've selected out extension.

so far 2 attempts have been following:

_clickedfolder = listbox1.selecteditem.tostring() - "folder"; _clickedfolder.trim(new char[] { '.folder' }); 

but neither of these work.

what correct way take file extension away , have file name display?

use path class:

string fnwithoutextension = path.getfilenamewithoutextension(path); 

or

string extension = path.getextension(path); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -