Solved

editing filename in string

Posted on 2011-03-01
3
187 Views
Last Modified: 2012-05-11
Hi,

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.
0
Comment
Question by:ChLa
3 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 50 total points
ID: 35008073
here
procedure TForm1.Button1Click(Sender: TObject);
var
  Ext, FilePart, FileName: string;
begin
  FileName := 'test.txt';
  Ext := ExtractFileExt(FileName);
  FilePart := ChangeFileExt(Filename, '');
  ShowMessage(Ext + '  ' +  FilePart);
end;

Open in new window

0
 
LVL 19

Expert Comment

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

http://www.delphibasics.co.uk/RTL.asp?Name=ExtractFileName
0
 

Author Closing Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 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