Jump to content

Read text file and Split String with double dots delimiter


boshi
 Share

Recommended Posts

Hello all autoit programmers,

I have been using this code to read a text file line by line

$File = FileOpen("email.txt", 0) ; open email.txt that contain email list line by line 

If $File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
While 1
    $Line = FileReadLine($File)
    If @error = -1 Then ExitLoop

    $EmailPass = StringRegExp($Line, "(.+@.+\..+)", 1)
    If @error = 0 Then

WEnd

So now i want to put the email with password using format like : stevenson77@hotmail.com:123pass

so i need to modify $EmailPass to separate between mail and pass using StringSplit or StringRegExp?

$email = StringSplit($EmailPass[0], ":")

is this ok? what the email and password variable would be? or anyone can make it look nice

$email[1] for the email ?

$email[2] for the password ?

Link to comment
Share on other sites

Hi boshi,

let's just assume your list looks like this:

e@mail.com:pw1234
f@mail.com:pw1235
g@mail.com:pw1236

then a StringSplit($line, ":")

would result in an array:

[0] => 2

[1] => e@mail.com

[2] => pw1234

or for the second line:

[0] => 2

[1] => f@mail.com

[2] => pw1235

Regards,

Hannes

:)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
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...