Solved

procedure to extract double quotes strings...

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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 68
Convert a string into a TDateTime 5 80
Tidtcpserver listening on multiports? 1 55
Slow Restore if incremental backups using RDiff.exe 4 51
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

732 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