Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import a comma-delimited file with no carriage line-feeds into a foxpro dbf 1

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
DE
I found much material of german adjectives on this page
Link

They are splitted in alphabetical groups (A to Z including German umlauts (Ä,Ö,Ü))
I wanted this to have in one column in a *dbf

I did this to have a readable txt-file:

copied all adjectives into Notepad ++ ,
eliminated the Headlines of the group headings
added a comma to the last line of each group of letters
transformed it into an ANSI file (to make the umlauts visible and readable)

- and saved that file as a *.txt file.


with this - I hoped to get a comma-separated file to append or import that into a *dbf.

append from mynewfile.txt delimited by ,

but that appends only the first word of each line.

Then I saw that no carriage line feed is at the end of each line.

How can I have programmatically a linefeed after each adjective to read vertically into one column of a dbf? (or another method?)

Thanks
Klaus


Peace worldwide - it starts here...
 
Several possibilities come to mind.

Perhaps the easiest is to do what you are already doing, up to the point of creating the new text file. In other words:

- copied all adjectives into Notepad ++ ,
- eliminated the Headlines of the group headings
- added a comma to the last line of each group of letters
- transformed it into an ANSI file (to make the umlauts visible and readable)
- and saved that file as a *.txt file.

Then, in VFP:

Code:
lcWords = FILETOSTR("thefile.txt")
lcLines = STRTRAN(lcWords, ",", CHR(13) + CHR(10))
STRTOFILE("another.txt", lcLines)

The text file, another.txt, will now contain the adjective, one per line.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike Lewis,
Thank you - I tried your code however it did not work at first.
It took me a while....
but when I changed the 3rd line - it was perfect.

Correction said:
lcWords = FILETOSTR("thefile.txt")
lcLines = STRTRAN(lcWords, ",", CHR(13) + CHR(10))
STRTOFILE("another.txt", lcLines)
STRTOFILE(lcLines,"another.txt")

I am now happy with it.
Btw. I never thought to find 6841 adjectives in my language.(german)
can you find more in English? [bigears]
Greetings
Klaus



Peace worldwide - it starts here...
 
Klaus,

Sorry about the error in STRTOFILE(). I was in a hurry when I typed it. Good that you saw it.

I'll bet there are a lot more than 6,841 adjectives in German, even though your list includes some pretty obscure ones. I don't know how many there are in English, but it must be at least 10,000.

I recently downloaded a list of 194,000 English words. If only ten percent of those are adjectives (and I suspect that it a low estimate), that still makes it over 19,000. There's no reason to suppose that German is less adjective-rich than English, especially as both languages are growing with new words coming along all the time. Anyway, that's my guess.

By the way, if you would like to know why I downloaded a list of 194,000 words, see thread1551-1811770.

Mike





__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top