Solved

procedure to extract double quotes strings...

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

20 Experts available now in Live!

Get 1:1 Help Now