473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reading each line in a variable

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
5 1694
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

"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
"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
* "=?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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
7
by: Richard Hollenbeck | last post by:
Help! I don't know why this isn't working: Private Sub Combo9_Change() Dim UsersCourseSelection As String UsersCourseSelection = Me("Combo9").Value Combo13.Visible = True 'the following...
2
by: Thief_ | last post by:
I'm using the following code to read in a web page as HTML: ' Download the web page using the chosen update method. Dim sr As New...
2
by: SteMc | last post by:
today I tackled, for the first time, opening and reading from a text file. Following the example on the MSDN and declared a variable, strline as a string and objstreamreader as a streamreader. ...
7
by: bhanuprakash | last post by:
I am trying to use fscanf to read my test file. In my test file i sometimes have blank lines. When I try to read using the following format. fscanf(fp,"%\n",temp_str); If there is any blank...
5
by: Anja | last post by:
Hi everyone, I have a question about text file reading with VBA. I want to read he whole contents of the file in one string variable. I have been able to successfully read lines using: Line...
15
by: arnuld | last post by:
This is the partial-program i wrote, as usual, i ran into problems halfway: /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a function to open a file for input and then read...
0
by: Nelu | last post by:
I would appreciate some comments on the code below for reading a line of text from a stream. #include <stdio.h> #include <stdlib.h> #include <stdint.h> /** * Reads a line of text from a...
19
by: Hapa | last post by:
Does only reading (never writing) of a variable need thread synchronisation? Thanks for help? PS. Anybody knows a Visual C++ news group?
3
by: xyz | last post by:
Hi, I have a text file around 7GB includes 100 million lines... I want to read the data line by line when I approach my module.. ie., when i read for the first time , my program shuld read only...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.