Hi all,
I hope someone can help me with this one.
Example:
I parse a text file (TStream) into an array.
Array:
Array = record
id:integer;
name:string;
lastname:string;
end;
The file is structured:
1 "Jack" "Moore"
2 "Mike" "Bold"
3 "Joe" "Cash"
...
I use TStrea.Read function to read a contetnt of a file, and then I parse the contect into Lines (TStringList) using :
ExtractStrings([#13],[' '],pchar(tekstfromfile),Lines);
which put into Lines each line from file int it's separate line. So Line[0]=1 "Jack" "More" , Line[1]=2 "Mike" "Bold" ...
It works OK, but the problem is if there is a signle quote ( ' )in name or lastname. Then it just messes up the whole data. It looks like it workd in a way that when it finds first single quote it looks for a closing single quote. And if it doesn't find it, it just assumes the whole rest of the text is as one string, instead of closed string with next ".
So if there's is a line 13 "Jack's" "Bold" ... it doesn't process the data correctly.
I tried all sort of things, but I just can't make it work.
Can someone give me some pointers what to do to tell Delphi to ignore single quote in my situation?
Thanx a lot guys.
I hope someone can help me with this one.
Example:
I parse a text file (TStream) into an array.
Array:
Array = record
id:integer;
name:string;
lastname:string;
end;
The file is structured:
1 "Jack" "Moore"
2 "Mike" "Bold"
3 "Joe" "Cash"
...
I use TStrea.Read function to read a contetnt of a file, and then I parse the contect into Lines (TStringList) using :
ExtractStrings([#13],[' '],pchar(tekstfromfile),Lines);
which put into Lines each line from file int it's separate line. So Line[0]=1 "Jack" "More" , Line[1]=2 "Mike" "Bold" ...
It works OK, but the problem is if there is a signle quote ( ' )in name or lastname. Then it just messes up the whole data. It looks like it workd in a way that when it finds first single quote it looks for a closing single quote. And if it doesn't find it, it just assumes the whole rest of the text is as one string, instead of closed string with next ".
So if there's is a line 13 "Jack's" "Bold" ... it doesn't process the data correctly.
I tried all sort of things, but I just can't make it work.
Can someone give me some pointers what to do to tell Delphi to ignore single quote in my situation?
Thanx a lot guys.