I'd like to delete the last four characters of a line
of text contained in a String variable named S:
// Should S really be a String ?
S, T, N: String;
// N.B. : All the lines of DropMemo
// are character strings of filenames
// of various lengths :
// For each line of text in DropMemo
for I := 0 to DropMemo.Lines.Count - 1 do
// Put the current line of text in S
S := DropMemo.Lines[I];
// Concatenate the text in CheminEdit and S
// to create the final character string T
T := CheminEdit.Text + S;
// Here I'd like to delete
// the last four characters
// of the character string S
>> S := S - last4characters; <<
// so that I can add .bat at the end
// to make the filename N
N := S + '.bat';
// BTW, can I create the file with a path
// like c:\my1stfolder\my2ndfolder
// instead of no path ???
In general, I'd like to know how to
manipulate character strings easily...
Thanks a lot,
Basile ;) Absolute beginner in Delphi 6 ;)
P.S. : At www.madshi.net
I found mad*,
a freeware VCL component collection
by Mathias Rauen which contains functions like
DeleteR => DeleteR('test123', 3) -> 'test'
or ReplaceStr => ReplaceStr('Funnyny.', 'Funny', 'Fun') -> 'Funny.'
but I'd really like to know if there isn't a simple way
to do that with the default Delphi 6 functions...