Article View: borland.public.cppbuilder.nativeapi
Article #6177Re: tab separated data
From: Hans Galema
Date: Tue, 07 Jun 2005 19:24
Date: Tue, 07 Jun 2005 19:24
28 lines
1763 bytes
1763 bytes
Pieter wrote:
> I have a line (a String) with some data in it separated with a tab (4 or 5 tabs). the line looks like:
> aaaaaaa bbbbbb ccccc dddd
>
> How can I process this line and get every "field"?
There are a lot of ways. I do not know why you posted this problem in the
native api group. But using the VCL this would demonstrate how you could
do it:
void __fastcall TForm1::Button3Click(TObject *Sender)
{
AnsiString TabbedLine = "aaaa\tbb\tcccc\tdddddddd\teeee";
TStringList *StringList = new TStringList;
StringList->CommaText = TabbedLine;
int linenr = -1;
while ( ++linenr < StringList->Count )
ShowMessage ( StringList->Strings[linenr] );
delete StringList;
}
Hans.
Technical Details
Message-ID:
<42a5f54e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.germany.com!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42a5f0db$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cd1aa1298832bdc7 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 07 Jun 2005 21:24:52 +0200 From: Hans Galema <notused@notused.nl> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: tab separated data References: <42a5f0db$1@newsgroups.borland.com> In-Reply-To: <42a5f0db$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <42a5f54e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118172494 129.125.201.248 (7 Jun 2005 12:28:14 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.germany.com!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail