Jump to content

Detecting new Line with StringSplit


Recommended Posts

Hello!

I'm making a program with autoIT where i put down a Editbox (with KodaGUI)
and i need to split the input data from that, by newline.
Until now i did the splitting with space ( " " ), but i need to split with newline. tried with  "\n" but didnt work :P
and i'm not sure how to do properly with "@CR or @CRFL or @FL".. I tried to change for these, but its making weird outputs.

Here is my Codepart:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Convert_kivalaszt
            $Edit1_data = GUICtrlRead($Fajlok_edit)
         Case $Convert_button
            Global $Userdata = StringSplit( $Edit1_data, " ")
            
....
..

 

Link to comment
Share on other sites

Good morning @Fortitude, and welcome to the AutoIt forum :)

Quote

Until now i did the splitting with space ( " " ), but i need to split with newline.

If you write in your Edit some text, new line, and write some other text, and copy this text and paste to Notepad++ ( for example ), you will notice that at the end of the line, the character @CRLF is added.
So, what you have to do, is something like this:

Local $strReadFromEdit = "This" & @CRLF & "is" & @CRLF & "text", _                                   ; From the Help file about StringSplit():
      $arrReadFromEdit = StringSplit($strReadFromEdit, @CRLF, BitOr($STR_NOCOUNT, $STR_ENTIRESPLIT)) ; Note that the macro @CRLF is actually a 2 character string, so unless the flag
                                                                                                     ; parameter to $STR_ENTIRESPLIT extra blank lines will be generated as the string
                                                                                                     ; is split on both @CR and @LF.
    _ArrayDisplay($arrReadFromEdit)

Always take a look at the Help file before posting something here! :)


Best Regards.


 

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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