Codemike Posted February 27, 2011 Posted February 27, 2011 If I do StringSplit(clipget(), " ") how I can do that line last word and new line first word don't merge? (I can see that if I use _ArrayDisplay() ).
UEZ Posted February 27, 2011 Posted February 27, 2011 (edited) Try something like this: #include <Array.au3> $t = ClipGet() $aT = StringSplit(StringReplace($t, Chr(13), ""), Chr(10), 2) Dim $aFinal[UBound($aT)][100000] $ub = 0 For $h = 0 To UBound($aT) - 1 $array = StringSplit($aT[$h], "", 2) If $ub < UBound($array) Then $ub = UBound($array) For $i = 0 To UBound($array) - 1 $aFinal[$h][$i] = $array[$i] Next Next ReDim $aFinal[UBound($aT)][$ub] _ArrayDisplay($aFinal) This is just a simple example and has enough room for improvement. Br, UEZ Edited February 27, 2011 by 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Codemike Posted February 27, 2011 Author Posted February 27, 2011 Try something like this: #include <Array.au3> $t = ClipGet() $aT = StringSplit(StringReplace($t, Chr(13), ""), Chr(10), 2) Dim $aFinal[UBound($aT)][100000] $ub = 0 For $h = 0 To UBound($aT) - 1 $array = StringSplit($aT[$h], "", 2) If $ub < UBound($array) Then $ub = UBound($array) For $i = 0 To UBound($array) - 1 $aFinal[$h][$i] = $array[$i] Next Next ReDim $aFinal[UBound($aT)][$ub] _ArrayDisplay($aFinal) This is just a simple example and has enough room for improvement. Br, UEZ Thanks, but I'm a beginner in the programming and I have tryed much think how I can continue that I get words that original form without words merge (and can use example $word[x] call)?
UEZ Posted February 27, 2011 Posted February 27, 2011 Do you want to split in words instead of letters? 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Codemike Posted February 27, 2011 Author Posted February 27, 2011 Do you want to split in words instead of letters?Br,UEZWords if it is possible some way? (I have done some program when I noticed that line last word and new line first word merge in StringSplit and looking hard solving to problem.)
UEZ Posted February 27, 2011 Posted February 27, 2011 (edited) If you replace line 7 with $array = StringSplit($aT[$h], " ", 2) it will split at space. Br, UEZ Edited February 27, 2011 by 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Codemike Posted February 27, 2011 Author Posted February 27, 2011 If you replace line 7 with $array = StringSplit($aT[$h], " ", 2) it will split at space. Br, UEZ Thanks very much that you try to help me. But this your example unfortunately don't work. Maybe problem is very difficult because anyone else don't help?
Moderators SmOke_N Posted February 27, 2011 Moderators Posted February 27, 2011 This is one of those times where you've attempted to follow the forum rules, and the translation is getting lost I think. I'd suggest you posting your question in your native language now. Maybe someone that speaks it will understand. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators Melba23 Posted February 27, 2011 Moderators Posted February 27, 2011 Codemike,I believe the problem (and solution) is very simple. You are splitting the text on the spaces and the @CRLF at the end of each line is not splitting.Just use StringReplace to change the @CRLF to spaces and the StringSplit works as you wish: #include <Array.au3> $sText = "This is line 1" & @CRLF & _ "This is line 2" & @CRLF & _ "This is line 3" & @CRLF & _ "This is line 4" $aStringSplit = StringSplit(StringReplace($sText, @CRLF, " "), " ") _ArrayDisplay($aStringSplit)Is that what you wanted? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mat Posted February 27, 2011 Posted February 27, 2011 The way I'd do it Melba is use StringStripCR and then use the fact that StringSplit accepts multiple splits... You might also want to treat double spaces as being one: #include <Array.au3> $sText = "This is line 1" & @CRLF & _ "This is line 2" & @CRLF & _ "This is line 3" & @CRLF & _ "This is line 4" $aStringSplit = StringSplit(StringStripWS(StringStripCR($sText), 4), " " & @LF) _ArrayDisplay($aStringSplit) Just a few more things to think about Mat AutoIt Project Listing
Codemike Posted February 27, 2011 Author Posted February 27, 2011 The way I'd do it Melba is use StringStripCR and then use the fact that StringSplit accepts multiple splits... You might also want to treat double spaces as being one: #include <Array.au3> $sText = "This is line 1" & @CRLF & _ "This is line 2" & @CRLF & _ "This is line 3" & @CRLF & _ "This is line 4" $aStringSplit = StringSplit(StringStripWS(StringStripCR($sText), 4), " " & @LF) _ArrayDisplay($aStringSplit) Just a few more things to think about Mat Thanks very much evryone who help me. Yes now it works what I need. #include <Array.au3> clipget() $sText = clipget() $aStringSplit = StringSplit(StringReplace($sText, @CRLF, " "), " ") _ArrayDisplay($aStringSplit)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now