Solved

procedure to extract double quotes strings...

Posted on 2004-09-14
4
186 Views
Last Modified: 2010-04-23
Hi guys,

I have this simple problem... Suppose I have some string with this format:

"01 Aguascalientes                     "  "003 Calvillo                                                                                            "  "33     Industrias de la madera y productos de madera. incluye muebles                                             "  "48   "

(note: this is a one long string)

I want to extract the double quotes strings to get in separated strings:

A = "01 Aguascalientes"
B = "003 Cavillo"
C = "33     Industrias de la madera y productos de madera. incluye muebles"
D = "48"

Anyone can help me?

best regards,
Manuel Lopez (lopem)
0
Comment
Question by:lopem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 150 total points
ID: 12057832
use quotedchar and delimitedtext properties of TStrings

procedure TForm1.Button1Click(Sender: TObject);
var
List: TSTrings;
begin
List := TSTringLIst.Create;
List.QuoteChar := '"';
List.DelimitedText := '"01 Aguascalientes                     "  "003 Calvillo                                                                                            "'+
                     '  "33     Industrias de la madera y productos de madera. incluye muebles                                             "  "48   "';
Listbox1.Items.Assign(List); //this is just to show the result. You can get separated strings in List.Items
List.Free;
end;
0
 
LVL 3

Author Comment

by:lopem
ID: 12057891
Wow! a fast answer!...  I was thinking in some char analysis. This trick is really clever. Thanks
best wishes
Manuel Lopez (lopem)
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12057897
please see code below


procedure TForm1.Button1Click(Sender: TObject);
var
  s:string;
  sa:array [1..256] of String;
  index:integer;
  i:integer;
begin
  s:='"a" "b" "c"';

  index:=pos('" "',s);
  i:=1;
  while (index<>0) do
  begin
            sa[i]:=copy(s,1,index);
            Inc(i);
    s:=copy(s,index+Length('" "')-1,Length(s));
  end;
end;
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12057962
Glad to have helped you :)

F68 ;-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question