Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


editing filename in string

Posted on 2011-03-01
Medium Priority
Last Modified: 2012-05-11

I have a string with a filename in it. I need to separate the name form the extension, into two strings. I know how to do this by reading each character and looking for the period. What I am asking, is if there is something in Delphi to do this automatically.
Question by:ChLa
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
LVL 32

Accepted Solution

Ephraim Wangoya earned 200 total points
ID: 35008073
procedure TForm1.Button1Click(Sender: TObject);
  Ext, FilePart, FileName: string;
  FileName := 'test.txt';
  Ext := ExtractFileExt(FileName);
  FilePart := ChangeFileExt(Filename, '');
  ShowMessage(Ext + '  ' +  FilePart);

Open in new window

LVL 19

Expert Comment

ID: 35010964
Here is a list of filename functions...

Author Closing Comment

ID: 35017972
thank you...that saved me a lot of time

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 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