[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# procedure to extract double quotes strings...

Posted on 2004-09-14
Medium Priority
189 Views
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
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
• 2

LVL 23

Accepted Solution

Ferruccio Accalai earned 600 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

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

ID: 12057897

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 23

Expert Comment

ID: 12057962
Glad to have helped you :)

F68 ;-)
0

## Featured Post

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
###### Suggested Courses
Course of the Month13 days, 20 hours left to enroll