dougerstew
Programmer
I have received the "basic" program to remove commas from a text file before importing into foxpro and it has worked well until now.
If all you want to do is replace ALL commas, this will get you started:
STORE 0 TO nInHandle, nOutHandle
STORE '' TO cTmpStr
STORE 'InFile.TXT' TO cInFile
nInHandle = FOPEN(cInFile)
nOutHandle = FCREATE('OutFile.TXT')
IF nInHandle < 0 .OR. nOutHandle < 0
?'Error'
RETURN
ENDIF
DO WHILE !FEOF(nInHandle)
cTmpStr = FGETS(nInHandle)
cTmpStr = ChrTran(cTmpStr , ',', '')
=FPUTS(nOutHandle, cTmpStr )
ENDDO
=FCLOSE(nInHandle)
=FCLOSE(nOutHandle)
ERASE (cInFile)
RENAME outfile.txt TO (cInFile)
Can someone tell me how to tweak this to only eliminate commas in numbers and add back in space before the numbers?
Thanks!
Doug Stewart
If all you want to do is replace ALL commas, this will get you started:
STORE 0 TO nInHandle, nOutHandle
STORE '' TO cTmpStr
STORE 'InFile.TXT' TO cInFile
nInHandle = FOPEN(cInFile)
nOutHandle = FCREATE('OutFile.TXT')
IF nInHandle < 0 .OR. nOutHandle < 0
?'Error'
RETURN
ENDIF
DO WHILE !FEOF(nInHandle)
cTmpStr = FGETS(nInHandle)
cTmpStr = ChrTran(cTmpStr , ',', '')
=FPUTS(nOutHandle, cTmpStr )
ENDDO
=FCLOSE(nInHandle)
=FCLOSE(nOutHandle)
ERASE (cInFile)
RENAME outfile.txt TO (cInFile)
Can someone tell me how to tweak this to only eliminate commas in numbers and add back in space before the numbers?
Thanks!
Doug Stewart