Link to home
Start Free TrialLog in
Avatar of vbMarkO
vbMarkO

asked on

String Manipulation How do I Change extension of file? IE: somefile.txt to somefile.mis

How do I change the extension of a file from

somefile.txt  to somefile.xml   or somefile.mis and such like ...

I know this is string manipulation here but I am very out of practice

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As sirbounty has suggested the String.Replace method is the directy approach.

But you might also wanna take a look at the Path.ChangeExtension method.  It is designed to do precisely what you want.  Take a look at other members of the Path class, you might find them useful... they allow you easily to break up the full path into it's consitutient parts (drive letter, path, file name, extention, etc)

http://msdn2.microsoft.com/en-us/library/system.io.path.changeextension.aspx
http://msdn2.microsoft.com/en-us/library/system.io.path.aspx
Happy to help - thanx for the grade! :^)