Reading each line in a variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I want to read line by line in a variable, but it could not be foward only , it need to be forward and backward, it also needs to say me which line it is reading. I do not know if it is possible.

Thanks in advance

ltt19
 
Explain more . . .

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

ltt19 said:
Hi,
I want to read line by line in a variable, but it could not be foward only
, it need to be forward and backward, it also needs to say me which line it
is reading. I do not know if it is possible.
 
I want to read line by line in a variable, but it could not be foward only , it need
to be forward and backward, it also needs to say me which line it is reading.
I do not know if it is possible.

Variables in and of themselves don't have "lines." Please elaborate.
 
ltt19 said:
Explaining better,

I need to read echa line in a variable, that is big, and has many lines, i need something like:

ThisLine = FullVaraible.ReadNextLine
or
ThisLine = FullVariable.ReabBackLine
or even
ThisLine = FullVariable.Readline(87)

this would be perfect

Did I explain it better? Anything just reply this post.

See if String.Split can help you out.
 
* "=?Utf-8?B?bHR0MTk=?= said:
I want to read line by line in a variable, but it could not be foward
only , it need to be forward and backward, it also needs to say me which
line it is reading. I do not know if it is possible.

Not sure if I understand what you want to do...

\\\
Dim astr() As String = Split(s, ControlChars.NewLine)
///

.... will split a string containing multiple lines separated by newline
strings and assign the parts to an array of strings.
 
Hi,
I want to read line by line in a variable, but it could not be foward only , it need to be forward and backward, it also needs to say me which line it is reading. I do not know if it is possible.

Thanks in advance

ltt19

If you have a very large string and want to read through it, check out the
StringReader class. It allows you to read through a string with methods
like .Read and .ReadLine and .Peek:

Dim sRdr As New StringReader(sSomeLongString)
Dim sLine As String

sLine = sRdr.ReadLine()

It does not seem to allow backward navigation, however.

You can also use a MemoryStream with a array of characters:

Imports System.Text

Dim oMStrm As New MemoryStream(Encoding.Default.GetBytes(sSomeLargeString))

The MemoryStream allows seeking.

Hope this helps

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Back
Top