Solved

procedure to extract double quotes strings...

Posted on 2004-09-14
4
182 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now