By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,061 Members | 1,539 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,061 IT Pros & Developers. It's quick & easy.

Reading each line in a variable

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Explain more . . .

--

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

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

"ltt19" <lt***@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
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

Nov 20 '05 #2

P: n/a

"ltt19" <lt***@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
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.
Nov 20 '05 #3

P: n/a
"ltt19" <lt***@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
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.
Nov 20 '05 #4

P: n/a
* "=?Utf-8?B?bHR0MTk=?=" <lt***@discussions.microsoft.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #5

P: n/a
On Fri, 23 Jul 2004 12:30:01 -0700, ltt19 wrote:
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(sSomeLargeS tring))

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.
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.