[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Pulling a file extension

Posted on 2009-07-05
3
Medium Priority
?
271 Views
Last Modified: 2012-05-07
In c# what is an easy way to find a file extension.

My current way is kinda messy, and is very easy for the user to mess up.

The exact thing required is for the program to go forward one file, and look at a file of extension *.F*  where the second star is a number 4-10

Any Suggestions?
0
Comment
Question by:cotj73
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
Rahul Goel ITIL earned 700 total points
ID: 24782526
You can use RegEx to achieve the same.
0
 
LVL 1

Assisted Solution

by:vaibhav_dw
vaibhav_dw earned 700 total points
ID: 24782547
Hi

Are you trying to extract the extension from the filename as the string or you have the filestream?

If you have just the filename as the string then you can traverse the string backwords till the period(.) and then traverse extactly 3 characters to get the extension. This is simply playing with the string.

Could you please tell exactly what do you have as a file so that I can help you out.

0
 
LVL 7

Assisted Solution

by:Raghu Mutalikdesai
Raghu Mutalikdesai earned 600 total points
ID: 24783299
// path is your file path
System.IO.Path.GetExtension(path)
System.IO.Path.GetFileNameWithoutExtension(path)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question