len() should count every character und you could use ord() to return which character is be left. I'm not sure if it worked but you could create unvisible characters like a line-break in xls and use copy+paste to include these characters in your purgechar().
Maybe you need to extend your logic for a replace() or trim() part.
I tried it out and when I include a TRIM() around the contents of the field,
- the "empty" line_breaks are gone and
- the "foreign" text also
=> so I guess it was the chr(10).
I will try out how it works out in the larger context of the entire code, but I guess that should do it.
Thanks a lot!
I have just found out that because I tested on just one set of possible base_lists and then on another, not "switching backward" so to speak, I have overlooked something:
- In that subroutine, I have two checks: One for linebreaks within a field and one for "foreign" text
- In a subsequent check, records with >=1 "foreign" character will be disregarded and an alarm will be triggered so
that someone will have a look and clean them manually.
<=> I just noticed that when there are linebreaks AND several lines actually filled in that one record, then there are also "foreign" characters, so it's probably the chr(10).
So I will now try out Aaron's suggestion with the chr(10).