Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String manipulation in VFP6
Message
De
25/06/2001 13:40:14
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00522546
Message ID:
00523075
Vues:
13
Andrew,

This solution worked great, however, our text file contains spaces and this routine doesn't like spaces in the string. Other than that, this worked great.

Any idea why MLINE() doesn't like spaces?

Thanks,

Jerryt



>Don't forget thet VFP has SET MEMOWIDTH - Try something like this:
>
* create a sample file
>* with 1000 lines 40 to 119 characters long
>strtofile('', 'c:\temp\testline.txt')
>for i = 1 to 1000
>	strtofile(repl('*', int(rand() * 80) + 40) + chr(13), 'c:\temp\testline.txt', .t.)
>endfor
>
>* read the file into a string
>local ltStart, ltFileStart, ltFinish
>ltStart = datetime()
>lcWholeFile = filetostr('c:\temp\testline.txt')
>local lnMemoWidth
>lnMemoWidth = set('memowidth')
>set memowidth to 80
>
>ltFileStart = datetime()
>_mline = 0
>*!*	strtofile('', 'c:\temp\testlineout.txt')
>lnOutFile = fcreate('c:\temp\testlineout.txt')
>for i = 1 to memlines(lcWholeFile)
>*!*		strtofile(mline(lcWholeFile, 1, _mline) + chr(13), 'c:\temp\testlineout.txt', .t.)
>	fputs(lnOutFile, mline(lcWholeFile, 1, _mline))
>*!*		? mline(lcWholeFile, 1, _mline)
>endfor
>fclose(lnOutFile)
>set memowidth to lnMemowidth
>ltFinish = datetime()
>
>lcMessage = 'Start : ' + tran(ltStart) + chr(13) + 'File Start : ' + tran(ltFileStart) + ' - d1 : ' + tran(ltFileStart - ltStart) + chr(13) + ;
>	'Finish : ' + tran(ltFinish) + ' - d2 : ' + tran(ltFinish - ltFileStart) + ' - d3 : ' + tran(ltFinish - ltStart)
>
>wait wind lcMessage
>
>Cheers,
>
>Andrew
>
>>Using VFP6 SP4
>>
>>Are there any article on string manipulation in VFP6?
>>
>>I need to write a generic routine to parse any text file into 80 character lines and output these lines into a new text file, for sending up into a mainframe.
>>
>>I am currently grabbing the file with the STRTOFILE() into a memvar then I go through each character 1 character at a time to create this file. I also do some other testing but this is the idea.
>>
>>However, this technic seems slow, especially on a large text file.
>>
>>Any help would be great.
>>
>>Thanks,
>>
>>Jerryt
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform