Jump to content

Split Data in editcontrol


Recommended Posts

How do you split the data in an edit in lines?

I Try this: StringSplit(GUICtrlRead($Edit), @CRLF)

But the Help says This: "Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines."

How to split The data in lines without Creating extra strings?

(i Making The Command prompt with autoit :mellow: )

Tanx,

Matthieuautoitscripter

Edited by Matthieuautoitscripter
[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]
Link to comment
Share on other sites

Hi, welcome to the forum.

You can change the @CRLF into something else then split by what you changed it to.

The following function will take two parameters , the first your text and the second the delimeter to use which defaults to "|" if no parameter is given. If you can safely know that "|" doesnt appear in your text that will be fine otherwise chose something else that you know wont be in the text.

#include <Array.au3>

$sText = "How do you split the data in an edit in lines?" & @CRLF & _
        "I Try this: StringSplit($ReadEditCommand, @CRLF)" & @CRLF & _
        "But the Help says This: ""Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines." & @CRLF & _
        "How to split The data in lines without Creating extra strings?" & @CRLF & _
        "(i Making The Command prompt with autoit :) )" & @CRLF & _
        "Tanx,"

$aText = _StringSplitCRLF($sText)
_ArrayDisplay($aText)
Exit

Func _StringSplitCRLF($sText, $sDelimeter = "|")
    Local $sTemp = StringReplace($sText, @CRLF, $sDelimeter)
    Return StringSplit($sTemp, $sDelimeter)
EndFunc   ;==>_StringSplitCRLF
GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

You can use an entire string (i.e. "<br>", or @CRLF) as the delimiter if you set flag = 1. See help file under StringSplit().

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

Matthieuautoitscripter,

Welcome to the AutoIt forum. :mellow:

Just use the flag parameter in StringSplit to use the whole delimiter as the split: :P

#include <Array.au3>

$sText = "How do you split the data in an edit in lines?" & @CRLF & _
        "I Try this: StringSplit($ReadEditCommand, @CRLF)" & @CRLF & _
        "But the Help says This: ""Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines." & @CRLF & _
        "How to split The data in lines without Creating extra strings?" & @CRLF & _
        "(i Making The Command prompt with autoit :) )" & @CRLF & _
        "Tanx,"

$aText = StringSplit($sText, @CRLF, 1)

_ArrayDisplay($aText)

M23

Edit: We meet again, O flightless one! :party:

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

How do you split the data in an edit in lines?

I Try this: StringSplit(GUICtrlRead($Edit), @CRLF)

But the Help says This: "Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines."

How to split The data in lines without Creating extra strings?

(i Making The Command prompt with autoit :mellow: )

Tanx,

Matthieuautoitscripter

Matthieuautoitscripter,

Can i see your script?

I would like to know what you're doing!

I think you're good at AutoIt, so i realy want to see your script!

Thanks!

Link to comment
Share on other sites

The script was not finished, but i have screenshots.

(Dutch version of CMDM.exe)

Screenshot 1:

Posted Image

Screenshot 2:

Posted Image

The script works correct, but the commands are not finished!

And i have some errors...

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]
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...