Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending .txt files without spaces.
Message
 
To
08/05/2001 11:04:23
Jorge Villasenor
Luz y Fuerza Del Centro
Mexico City, Mexico
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00504731
Message ID:
00504764
Views:
16
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform