March 2000
Intermediate to advanced
576 pages
18h 13m
English
Delete Procedure
procedure Delete(var Str: string; StartingIndex, Count: Integer);
The Delete procedure removes
Count characters from a string, starting at
StartingIndex. If Count is more
than the number of characters remaining in the string,
Delete deletes the rest of the string, starting
from StartingIndex. Delete is
not a real
procedure.
The first character of a string has index 1.
If StartingIndex is not positive or is greater
than the length of the string, Delete does not
change the string.
If the Count is greater than the characters
remaining after the starting index, the rest of the string is
deleted.
If you want to delete characters at the end of a string,
SetLength is slightly faster than calling the more
general purpose Delete.
// Remove a drive letter from the front of a path.
procedure RemoveDriveLetter(var Path: string);
begin
// First make sure the path has a drive letter in front.
if (Length(Path) >= 2) and (Path[2] = ':') then
// Delete the first two characters of the path.
Delete(Path, 1, 2);
end;| Copy Function, Insert Procedure, SetLength Procedure, SetString Procedure |
Read now
Unlock full access