Solution. Use string 's rfind and replace member functions to find the extension and replace it.
You can also do it by right-clicking on the unopened file and clicking on the “Rename” option. Simply change the extension to whatever file format you want and your computer will do the conversion work for you.
And finally, if you just want to replace file extension use var newFilePath = Path. ChangeExtension(myffile, ". Jpg"); ; the newFilePath will contain a new file name with changed extension, physically, the file name (on disk) won't be changed.
Below is my string value
string strFile = @"http://login.com/Uploads/g05fgxeto4dvsf5531yb3l45_16_8_2011_1_25_37.doc";
And I need to replace this file path value by
http://login.com/Uploads/g05fgxeto4dvsf5531yb3l45_16_8_2011_1_25_37.pdf
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With