INPUT OR READ TO STRIP CHR(10) AND CHR(13) 
Author Message
 INPUT OR READ TO STRIP CHR(10) AND CHR(13)

I am in the process of upgrading a Visual Foxpro edi process to a VB process
with a SQL server in the back. My current problem is that I read the text
file (800+ K) into a string. One character at a time to strip out carriage
returns and line feeds. I am using the read function. I am wondering if the
older input function might work better. We are talking over two hours to do
what Fox was doing in about 15 minutes. Other than easier on the eyes I am
still waitng to see where VB is better but we are hoping that SQL server
will speed things up when it comes to the data.

Thanks

Here is the code
Do While myfile.AtEndOfStream <> True
        'Read One character in from the file
        strChar = myfile.Read(1)
        iCnt = iCnt + 1
        'Strip out line feeds and carriage returns
        If strChar = Chr(10) Then
            strChar = ""
            lnCount = lnCount + 1
            'DoEvents
        ElseIf strChar = Chr(13) Then
            strChar = ""
            lnCount = lnCount + 1
        Else
            strLine = strLine & strChar
        End If
        'Update Progress Captions
        lblCount.Caption = Str$(lnCount)
        lblCount2.Caption = iCnt

    Loop



Sun, 19 Jan 2003 03:00:00 GMT  
 INPUT OR READ TO STRIP CHR(10) AND CHR(13)


:
: I am in the process of upgrading a Visual Foxpro edi process to a VB
process
: with a SQL server in the back. My current problem is that I read the
text
: file (800+ K) into a string. One character at a time to strip out
carriage
: returns and line feeds. I am using the read function. I am wondering
if the
: older input function might work better. We are talking over two
hours to do
: what Fox was doing in about 15 minutes. Other than easier on the
eyes I am
: still waitng to see where VB is better but we are hoping that SQL
server
: will speed things up when it comes to the data.
:
: Thanks
:
: Here is the code
: Do While myfile.AtEndOfStream <> True
:         'Read One character in from the file
:         strChar = myfile.Read(1)
:         iCnt = iCnt + 1
:         'Strip out line feeds and carriage returns
:         If strChar = Chr(10) Then
:             strChar = ""
:             lnCount = lnCount + 1
:             'DoEvents
:         ElseIf strChar = Chr(13) Then
:             strChar = ""
:             lnCount = lnCount + 1
:         Else
:             strLine = strLine & strChar
:         End If
:         'Update Progress Captions
:         lblCount.Caption = Str$(lnCount)
:         lblCount2.Caption = iCnt
:
:     Loop
:
:



Sun, 19 Jan 2003 03:00:00 GMT  
 INPUT OR READ TO STRIP CHR(10) AND CHR(13)

Try something like this:

theFile1 = myFile.ReadAll
myFile.Close
 iCnt = Len(theFile1)
theFile2 = Replace(Replace(theFile1,vbCr,""),vbLf,"")
InCount = Len(theFile1) - Len(TheFile2)
lblCount.Caption = Str$(lnCount)
lblCount2.Caption = iCnt


:
: I am in the process of upgrading a Visual Foxpro edi process to a VB
process
: with a SQL server in the back. My current problem is that I read the
text
: file (800+ K) into a string. One character at a time to strip out
carriage
: returns and line feeds. I am using the read function. I am wondering
if the
: older input function might work better. We are talking over two
hours to do
: what Fox was doing in about 15 minutes. Other than easier on the
eyes I am
: still waitng to see where VB is better but we are hoping that SQL
server
: will speed things up when it comes to the data.
:
: Thanks
:
: Here is the code
: Do While myfile.AtEndOfStream <> True
:         'Read One character in from the file
:         strChar = myfile.Read(1)
:         iCnt = iCnt + 1
:         'Strip out line feeds and carriage returns
:         If strChar = Chr(10) Then
:             strChar = ""
:             lnCount = lnCount + 1
:             'DoEvents
:         ElseIf strChar = Chr(13) Then
:             strChar = ""
:             lnCount = lnCount + 1
:         Else
:             strLine = strLine & strChar
:         End If
:         'Update Progress Captions
:         lblCount.Caption = Str$(lnCount)
:         lblCount2.Caption = iCnt
:
:     Loop
:
:



Sun, 19 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. chr(10) and chr(13) in memofield gives |

2. Chr(10) & Chr(13)

3. Chr(10) and Chr(13) doesn't work

4. What is chr$(13) + chr$(10)

5. vbCRLF = chr(13) + chr(10)

6. is carriage return chr(13) or chr(32)

7. No Sentences in Title?! / No Chr(10) or Chr(13) in titles!!!

8. Global Const CR = chr$(13) + chr$(10) uh oh!?

9. chr(13) & chr(10) in a text box

10. Chr(13)

11. Replacing the Chr(13) with Javascript

12. Detect Return ( Chr(13) ) in a textarea

 

 
Powered by phpBB® Forum Software