Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ALLTRIM not trimming
Message
De
20/01/2010 19:41:30
 
 
À
20/01/2010 17:20:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01445103
Message ID:
01445121
Vues:
59
>>>I imported data from excel to a table.
>>>some fields have spaces on the left side. I replaced the field by ALLTRIM(field) but the left space did not go away as it should do.
>>>
>>>Then, I check for the LEFT(field,1) =" " but it failed. I can see the empty space but I don't know why VFP does not think it is a space. Any idea?
>>>
>>>Mo
>>
>>It must be some unprintable character.
>>
>>?asc(left(field,1))
>
>It is ASCii 160. how to get rid of it? I tried STRTRAN() with TRIM() but it did not fix it.
>
>Ooops. yes it worked. REPLACE field WITH alltRIM(STRTRAN(field,chr(160),""))

You can also do the following:
REPLACE field WITH ALLTRIM(field,1," ",CHR(160))

*-* OR

REPLACE field WITH ALLTRIM(field,1,CHR(20),CHR(160))
Note: the double quotes contains a space.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform