I'm probably stating the obvious, but:

1.  String indices are one-based,
2.  You can also extract one character out of a string by NewString[1].
(Which in Peter's example, will extract 'T').

Regards,
Dennis.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 17 April 2001 18:12
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Sub Strings
>
>
> Ok, I *like* easy ones:
>
> > I know I am going to kick myself for this one BUT how
> > do I get a part of a string from a string?
>
> thatString := copy(thisString,StartPos,Length_Desired);
>
> e.g.
>
> NewString := copy('This is the original',6,2);  // gets "is"
>
>
>
> cheers,
> peter
>
> ============================================
> Peter Hyde, WebCentre Ltd & SPIS Ltd, Christchurch, New Zealand
> * Web automation for online periodicals: http://TurboPress.com
> * TurboNote+: http://TurboPress.com/tbnote.htm
>   -- easy, small, handy onscreen sticky notes
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to