|
-
Mar 16th, 2002, 12:17 PM
#1
Thread Starter
Addicted Member
reading complete lines from a string
I opened a text file, loaded it into a string and now i want to read it line by line. How do i make this?
thnx
-
Mar 16th, 2002, 12:21 PM
#2
Addicted Member
Open STRFILENAME For Input As #1
Do While Not EOF(1)
Input #1, line
debug.print line
Loop
Close #1
-
Mar 16th, 2002, 12:23 PM
#3
Thread Starter
Addicted Member
can't i make this a loop? i'm using .net so i don't use the input thing.
-
Mar 16th, 2002, 12:31 PM
#4
Don't know why you would want to do it this way but you could use the split function to get each line and then loop through the array that is created.
-
Mar 16th, 2002, 12:34 PM
#5
Addicted Member
<code>can't i make this a loop? i'm using .net so i don't use the input thing
</code>
can't i make this a loop ?
din realli get the questions .
i'm using .net so i don't use the input thing
sorry , i do not know any anithing about .net, i m using vb 6. sorri for tat .
-
Mar 16th, 2002, 12:41 PM
#6
Thread Starter
Addicted Member
sorry,
i was thinking about a loop that reads through a string untill it sees an enter. I don't know how to see the enter. the rest is quite easy. Do u know of another way to do this without the line statement?
-
Mar 16th, 2002, 12:42 PM
#7
Addicted Member
'''''''''''''''''''''''''''''''''''''''
' Dim arr() As String
' Dim i As Integer
'
'
'
'
' Open App.Path & "this.txt" For Input As #1
' arr = Split(Input(LOF(1), 1), vbCr)
'
' Close #1
'
' For i = 0 To UBound(arr)
'' Debug.Print arr(i)
' MsgBox arr(i)
' Next i
'' ''''''''''''''''''''''''''''''''''''''
Anyway i use the do while not EOF , cos i think it is much simpler n din tok of the split() cos i hardly use it .., thaxs for pointing out
-
Mar 16th, 2002, 01:03 PM
#8
Thread Starter
Addicted Member
thnx, i changed it a bit and now it works, do u also know a way to split up a string like this
Hello=hallo
into
knownword = hallo
unknownword = hello
Thnx
-
Mar 16th, 2002, 01:10 PM
#9
Addicted Member
Hello=hallo
into
knownword = hallo
unknownword = hello
Thnx
u wan to change onli 1 letter in the sentence rite ?
if u are trying to change a letter u can use the Mid$() ?
unknownword=mid$(knownword,2,1)
-
Mar 16th, 2002, 01:17 PM
#10
Thread Starter
Addicted Member
ahhhh no not at all :-)
the 2nd line looks like this:
hallo=hello
how do i split this line up in hello and hallo?
-
Mar 16th, 2002, 01:28 PM
#11
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|