Re: copy one character from a string.
- From: "alanglloyd@xxxxxxx" <alanglloyd@xxxxxxx>
- Date: 24 Nov 2005 02:00:29 -0800
> S2:=S1; // S2 now points to S1, only one instance exists in memory. The
> string has a refcount of 2.
>
> S2[1]:='X'; // S2 is now copied into a newly allocated string, both S1 and
> S2 having a refcount of 1.
Or alternatively ...
S2:=S1; // S2 now points to S1, only one instance exists in memory.
The
string has a refcount of 2.
SetLength(S2, Length(S2)); // S2 is now copied into a newly allocated
string, both S1 and
S2 having a refcount of 1.
Or you could look up SetLength in Delphi Help for a full biography of
SetLength() <g>.
Alan Lloyd
.
- Follow-Ups:
- Re: copy one character from a string.
- From: Maarten Wiltink
- Re: copy one character from a string.
- References:
- copy one character from a string.
- From: MLian
- Re: copy one character from a string.
- From: Dodgy
- Re: copy one character from a string.
- From: MLian
- Re: copy one character from a string.
- From: Bjørge
- copy one character from a string.
- Prev by Date: Re: Writing Binary Files with TFileStream
- Next by Date: Re: Writing Binary Files with TFileStream
- Previous by thread: Re: copy one character from a string.
- Next by thread: Re: copy one character from a string.
- Index(es):