Jump to content

How to get the first line of a text ?


Recommended Posts

How to get the first line of a text ?

With this script :

$text = WinGetText("SampleText.txt", "")
MsgBox(0, "Text read was:", $text)

I get three lines in the $text string.

first line
second line
Third line

How to set $firstline with the first line from the $text string ?

Thanks.

Tintin92

Tintin92

Link to comment
Share on other sites

If you wanted, you could set first line to $firstline and second line to $secondline, etc.

$text = WinGetText("SampleText.txt", "")

$lines = StringSplit($text, @CRLF)

$firstline = $lines[1]

$secondline = $lines[2]

$thirdline = $lines[3]

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

If you wanted, you could set first line to $firstline and second line to $secondline, etc.

$text = WinGetText("SampleText.txt", "")

$lines = StringSplit($text, @CRLF)

$firstline = $lines[1]

$secondline = $lines[2]

$thirdline = $lines[3]

<{POST_SNAPBACK}>

Do the job.

Thanks.

Tintin92

Tintin92

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...