I have string , which I want to split into strings of equal size(characters) lets say 4 or 5.
Did some searching. Found this
This only works on numbers and not on general string.
Please Help me.
Thanks
Posted 28 April 2012 - 02:40 PM
Posted 28 April 2012 - 02:53 PM
#include <Array.au3> $sString = "1234abcd5678ghij1234abcd5678ghij" $aArray = StringRegExp($sString, ".{4}", 3) _ArrayDisplay($aArray)
Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display
RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
Posted 28 April 2012 - 02:54 PM
Posted 28 April 2012 - 03:21 PM
#include <Array.au3> Dim $aArray = _StringEqualSplit("abcdefghijklmnopqrstuvwxyz", 5) _ArrayDisplay($aArray) Func _StringEqualSplit($sString, $iNumChars) Return StringRegExp($sString, "(?s).{1," & $iNumChars & "}", 3) EndFunc
Edited by czardas, 28 April 2012 - 03:27 PM.
Posted 28 April 2012 - 03:25 PM
Yes , I know that.kritya,
Just look for any character and not just digits:If you want to start learning more about SREs, then I recommend this site.#include <Array.au3> $sString = "1234abcd5678ghij1234abcd5678ghij" $aArray = StringRegExp($sString, ".{4}", 3) _ArrayDisplay($aArray)
M23
Edited by kritya, 28 April 2012 - 03:33 PM.
Posted 28 April 2012 - 10:09 PM
0 members, 0 guests, 0 anonymous users