Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 3 Jahren
Letzter Beitrag:
vor 3 Jahren
Beteiligte Autoren:
Fabrice Harari, Al

[WD19] Nospace() and Left() not working with data from Excel

Startbeitrag von Al am 21.06.2015 02:08

Hello All

I am converting Excel data by reading the rows in an Excel file.
I am reading the data in row 1 of the file as Column headings to determine how to treat the data
SWITCH NoSpace(LColHeader)
CASE "Code"

The data in the cell is "Code " and neither the NoSpace() or Left() functions will strip off the spaces on the end. It is not just the data in row 1, a fair bit of the other data has spaces at the end that cannot be removed by these functions
I have changed the code to Position() and that works fine but I am curious if any one has a solution or any ideas as to what is going on.

The data was actually collected from a screen display of General Ledger accounts from a web page of the Xero Accounting software as a copy and then paste into an Excel page and then converted to csv so maybe that process introduced some sort of "hard" space that Windev doesn't recognise as a normal space ?

Regards
Al

Antworten:

Hello Al,

to know whats what, put the value coming from excel in a buffer, then do a buffertohexa and display the result... You'll see exactly what character is there

Best regards

von Fabrice Harari - am 21.06.2015 02:37
Hello Fabrice

Thanks for the idea. I just used a hex editor and pasted it in though :)

The spaces in the file are Hex A0. A normal space is hex 20 and in decimal they are '160' and 32 respectively

The A0 is a non breaking space that prevents an automatic line break (line wrap) at its position.

It's hard to see why the NoSpace() and Left() commands either don't remove it automatically or offer an argument to allow for its removal.

Regards
Al

von Al - am 21.06.2015 05:57
Hello Al,

Well.. it is a hard space that is supposed to always stay in place... And as a simple replace will do the job IF/WHEN you need to deal with hardspaces... I guess it's a simple implementation choice from pcsoft

Best regards

von Fabrice Harari - am 21.06.2015 11:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.