Jump to content

StringSearch


Recommended Posts

I am making a script for creating users and save it in a txt file.. where it is "username:password" ..

this is what i have

Func create()
$file = FileOpen("file.txt",9)
    
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    
    $lastline = FileReadLine($file,-1)
    
    If $lastline = "" Then
    
    $ID = GUICtrlRead($IDInput)
    $PW = GUICtrlRead($PassInput)
    
    FileWriteLine("$file", $ID & ":" & $PW & @CRLF) 

    EndIf

FileClose($file)    
EndFunc

My problem is.. i want to know wether there is the string ":" in the last line because if not the line is invalid for the program that i am creating the users for and it could be deleted and a new line could be added.. so i need a function where i say.. search the string "username:password" for the ":" .. is there such a function?

-Germinator

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...