Sign in to follow this  
Followers 0
xdp22

What number is biggest

3 posts in this topic

Hello, i need to do function, what return biggest number from file.

In example i got file

test.txt

1
8
101
9
11

So in this file biggest number is 101.

I tried do it :

#include <file.au3>
$e = _FileCountLines("totalne_testy1.txt")
$i=0
 
For $i = 0 To $e
Local $last,$last1
 
 
If FileReadline("totalne_testy1.txt", $i) > $last Then
$last = FileReadline("totalne_testy1.txt", $i)
EndIf
Next
 
MsgBox( 0, "", $last)

But doesn't work :|

Share this post


Link to post
Share on other sites



Try this:

#include <Array.au3>
$aNumber = StringSplit(StringStripCR(FileRead("totalne_testy1.txt")), @LF)
For $i = 0 To UBound($aNumber) - 1
    $aNumber[$i] = Number($aNumber[$i])
Next
_ArraySort($aNumber, 1)
MsgBox(0, "Biggest Number", "Biggest number: " & $aNumber[0])

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

My god it's working great, thanks :graduated:

Share this post


Link to post
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
Sign in to follow this  
Followers 0