Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending .txt files without spaces.
Message
 
À
08/05/2001 11:04:23
Jorge Villasenor
Luz y Fuerza Del Centro
Mexico City, Mexique
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00504731
Message ID:
00504764
Vues:
15
>I have this .txt file with 5 columns of info, it is delimited with blanks, each record is something like this:
>
>"NA048032 <20 spaces> 040502010100 <15 spaces> 000800 <20 Spaces> A05075300 <5 spaces> 00DIN"
>
>when using:
>
>APPEND FROM file.txt DELIMITED WITH BLANK
>
>I need to have a table with enough columns for every space in the record!!!
>
>Question: How can i ignore those nasty spaces?
You could add coma's and append DELIMITED WITH ,
myTextToString=FILETOSTR(MyFile.TXT)
do while OCCURS(" ",myTextToString) && " " while two blanks
myTextToString=strtran(myTextToString," "," ") && replace 2 blanks with on blank)
enddo
myTextToString=strtran(myTextToString," ",",") && replace 1 blank with coma
newText.txt=STRTOFILE(myTextToString)
then ..
APPEND FROM newText.txt DELIMITED WITH ,

* Or you could append the original file SDF
create cursor myCursor (Field1 C(28),Field2 C(27),Field3 C(26),Field4 C(14),Field5 C(5))
select myCursor
APPEND FROM MyFile.txt SDF
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform