Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
m.mystring = filetostr("c:\myfile.txt")
for i = 1 to memlines(m.mystring)
m.myline = mline(m.mystring,i)
for x = 1 to getwordcount(m.myline,",")
? getwordnum(m.myline,x,",")
next x
next
lcString = FILETOSTRING("MyFile.txt")
ALINES(laValues, lcString, 0, ",")
* The array laValues will now ocntain the individual values
m.myline = thisform.myeditbox.value
for x = 1 to getwordcount(m.myline,",")
messagebox( getwordnum(m.myline,x,","),48,str(x))
next x
GETWORDNUM is exactlya that, it is a function that gets a word from a string, so it extracts part of a string from a longer string. Usually it splits by spaces, as that's the normal dellimiter of words, but it has athe paramater to choose splitting by other characters, not only comma.Mandy Crow said:i thought there is a specific vfp command for extracting from string
SELECT tsulet
APPEND FROM filename TYPE CSV
SELECT tsulet
APPEND FROM filename FIELDS fname, sname, sex, grade, dobirth TYPE CSV
myself said:1,12,F,U
Data stored like that is called CSV - short for comma separated values. Especially with many lines all with the same number of values and commas.
You can use APPEND FROM filename TYPE CSV for reading them into a DBF, the DBF just has to have 4 fields in this case and must be used and selected before the APPEND.
Mandy,Crow,f
Tamar,Granor,f
Mike,Lewis,m
Chris,Miller,m
Griff,MG,m
Create Cursor import (id int autoinc, lname c(20), fname c(20), sex C(1))
Append From ("c:\data\people.txt") FIELDS fname,lname,sex TYPE CSV
Browse