I am reading a textfile and ready to import into an access database. The issue that has just arisen of hidden characters in line of text. The file is sent to us by a third party.
Problem_Details: all the objects were all very soft and were split and therefore unfit for sale.
As you can see at the end of the line there appears to be a double space. It is actually a space and a ÿ (alt+0255).
When the program reads in the line (variable s) it only shows
Problem_Details: all the objects were all very soft and were split and therefore unfit for
missing the word 'sale'.
Here is my code
temptext,outtext : TextFile;
s,ln,bn,pc,ct,pd,cl,pm,wl : string;
i : integer;
while not eof(temptext) do
Cursor := crHourGlass;
i := length(s);
if Copy(s,0,17) = 'PROBLEM_CATEGORY:' then ct :=copy(s,20,8);
if Copy(s,0,16) = 'Problem_Details:' then pm :=copy(s,19);
if Copy(s,0,14) = 'Branch_Number:' then bn := copy(s,17,3);
if Copy(s,0,13) = 'Product_Date:' then pd := copy(s,16,8);
if Copy(s,0,13) = 'Packers_Code:' then pc := copy(s,16,20);
if Copy(s,0,12) = 'CLAIM_VALUE:' then cl :=copy(s,15,6);
if Copy(s,0,12) = 'Line_Number:' then ln := copy(s,15,5);
if Copy(s,0,11) = 'WhenLogged:' then wl := copy(s,14,10);
if Copy(s,0,9) = 'CallType:' then ct := copy(s,12,8);
if (copy(s,0,11) = '$UpdatedBy:') then
if pd = '' then pd := edit2.text;
if (copy(pd,3,1) <> '/') and (copy(pd,6,1) <> '/') then pd := edit2.text;
if pc = '' then pc := 'not recorded';
if cl = '' then cl :='0.00';
edit1.text := ln+'^'+bn+'^'+pc+'^'+ct+'^'+pd+'^'+cl+'^0.00^'+wl+'^'+pm;
if edit1.text <> '^^^^^^^^^' then Writeln(outtext,edit1.text);
ln := '';
bn := '';
pc := '';
ct := '';
pd := '';
cl := '';
pm := '';
wl := '';
Cursor := crArrow;
Edit1.text := 'Branch Translation Finished';
The length of the string is correct, it just doesn't show / copy anything after the ÿ.
I can not see why having this character ÿ should be a pain, or how to overcome the issue. This character can appear anywhere!