Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hai,

i am having one string which is asdads.jpg ,now i want to show only tat file name without extension, how can i do tat pls help me...i used path.changeextension then also the output is not perfect
Posted

Use
string fileName = @"C:\dir\newfile.ext";
string path = Path.GetFileNameWithoutExtension(fileName);
 
Share this answer
 
 
Share this answer
 
Comments
Kim Togo 28-Jul-11 2:12am    
And 5 to you :-)
Gordon Beeming 28-Jul-11 8:40am    
5
Kim Togo 28-Jul-11 8:41am    
Thanks
walterhevedeich 28-Jul-11 19:43pm    
Thank you.
 
Share this answer
 
Comments
walterhevedeich 28-Jul-11 2:11am    
Beat me to it. Have a 5. :)
Gordon Beeming 28-Jul-11 8:40am    
5
 
Share this answer
 
Comments
walterhevedeich 28-Jul-11 2:11am    
Beat me to it. Have a 5. :)
Kim Togo 28-Jul-11 2:13am    
Right on. 5.
Gordon Beeming 28-Jul-11 8:40am    
5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900