Description |
The Move procedure is a badly named method of copying a section of memory from one place to another.
CopyCount bytes are copied from storage referenced by SourcePointer and written to DestinationPointer
It can be used to take a copy of a substring from one string and overlay it on top of part of another string.
If copying from the current string to another part of the same string, then Copy works intelligently, preserving data where appropriate.
|
|
Notes |
The original data is always preserved, unless moving fronm and to the current string - so Move is not very informative.
There is no checking on the referenced storage areas - be careful about all direct storage operations such as this.
|
|
Related commands |
AnsiReplaceStr |
|
Replaces a part of one string with another |
Concat |
|
Concatenates one or more strings into one string |
Copy |
|
Create a copy of part of a string or an array |
Delete |
|
Delete a section of characters from a string |
Insert |
|
Insert a string into another string |
StringOfChar |
|
Creates a string with one character repeated many times |
StringReplace |
|
Replace one or more substrings found within a string |
StuffString |
|
Replaces a part of one string with another |
WrapText |
|
Add line feeds into a string to simulate word wrap |
|
|
|
Example code : Copying a part of one string into the middle of another |
var
source, dest : string;
begin // Set up our starting string
source := '123456789';
dest := '---------';
// Copy a substring from source into the middle of dest
Move(source[5], dest[3], 4);
// Show the source and destination strings
WriteLn('Source = '+source);
WriteLn('Dest = '+dest);
end;
|
Show full unit code |
Source = 123456789
Dest = --5678---
|
|