|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| [WD19] Nospace() and Left() not working with data from Excel |
| Iniciado por guest, 21,jun. 2015 04:08 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 21,junio 2015 - 04: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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2015 - 04:37 |
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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2015 - 07:57 |
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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2015 - 13:49 |
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 |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|