🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.documentation
Article #144

Re: Turbo Delphi - String Splitting - related to the help and documentation

#144
From: Robert MacMillan
Date: Mon, 30 Jul 2007 11:55
60 lines
2968 bytes
DJSox wrote:
> The Delphi function ExtractStrings will split a string up into substrings 
> based on a delimiter character.
> 
> Dan
> 
> 
Unfortunately I am not understanding this. I have tried all sorts of 
permuations of the following to no avail. This one returns the error 
"[Pascal Error] frmMainForm.pas(66): E2010 Incompatible types: 'string' 
and 'PAnsiChar'" but no combination of the Strings etc works.

In simple terms, Dataln is a string [Which reads 'Going,randwick,slow'] 
which I need to break out into its components.

==============================================================
var
   MainForm: TMainForm;
   ScratchingsArray: Array of String;
   i: integer;
   idisp: string;
   Dataln: string;
   Contents1: TStringlist;
implementation

{$R *.dfm}

procedure TMainForm.Exit1Click(Sender: TObject);
begin
   Close;
end;


procedure TMainForm.FileSaveAs1Accept(Sender: TObject);
var
   Counter1: Integer;

begin
   Contents1:= Tstringlist.create;
   i:= Scratchings.Lines.Count;
   idisp:= InttoStr(i);
   ShowMessage('Number of lines is '+ idisp);
   Scratchings.Lines.SaveToFile('Southcoast.txt');
   for Counter1 := 0 to i - 1 do
     begin
       Dataln:= Scratchings.Lines.Strings[Counter1];
       ShowMessage('Counter1 is'+InttoStr(Counter1));
       ShowMessage('Data on the line is '+ Dataln);
       If Dataln <> 'Track Conditions' Then
       ExtractStrings([','],[],Dataln,Contents1)   <==================== 
this is the problem line ==========================>
     end;
end;
===========================================================

Many many hours wasted trying all sorts of ways of doing this which in 
Paradox is already operational with a simple one line expression which 
would read

Dataln.breakApart(Contents1,",")
Technical Details
Message-ID: <46add1a3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46ad51f8$1@newsgroups.borland.com> <46ad6a43$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10a202,9e8c64573cb861fd
X-Google-Attributes: gid10a202,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 30 Jul 2007 21:55:17 +1000
From: Robert MacMillan <macfam@bigpond.net.au>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.documentation
Subject: Re: Turbo Delphi - String Splitting - related to the help and documentation
References: <46ad51f8$1@newsgroups.borland.com> <46ad6a43$1@newsgroups.borland.com>
In-Reply-To: <46ad6a43$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 58.175.188.72
Message-ID: <46add1a3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1185796515 58.175.188.72 (30 Jul 2007 04:55:15 -0700)
Lines: 60
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 2817