algiuxas Posted October 7, 2017 Share Posted October 7, 2017 (edited) Hello, I'm making SVG parser, and some SVG editors save SVG files with syntax like this for example: transform="translate(30) rotate(45 50 50) matrix(1,2,3,4,5,6)" Anybody could give me suggestion how to split it like this? ["translate(30)", "rotate(45 50 50)", "matrix(1,2,3,4,5,6)"] Edit: Opps! I accidently posted this on "GUI Help and Support"... Edited October 7, 2017 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore. Link to comment Share on other sites More sharing options...
iamtheky Posted October 7, 2017 Share Posted October 7, 2017 $str = 'transform="translate(30) rotate(45 50 50) matrix(1,2,3,4,5,6)"' $array = stringsplit(stringtrimleft($str , 10) , ") " , 3) msgbox(0, '' , '[' & $array[0] & ')", "' & $array[1] & ')", "' & $array[2] & ']') algiuxas 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 7, 2017 Moderators Share Posted October 7, 2017 algiuxas, A simple StringReplace does the trick: $sTransform = "translate(30) rotate(45 50 50) matrix(1,2,3,4,5,6)" $sRequired = '["translate(30)", "rotate(45 50 50)", "matrix(1,2,3,4,5,6)"]' $sChanged = '["' & StringReplace($sTransform, ") ", ')", "') & '"]' ConsoleWrite($sChanged & @CRLF & $sRequired & @CRLF) 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 Link to comment Share on other sites More sharing options...
algiuxas Posted October 7, 2017 Author Share Posted October 7, 2017 5 minutes ago, iamtheky said: $str = 'transform="translate(30) rotate(45 50 50) matrix(1,2,3,4,5,6)"' $array = stringsplit(stringtrimleft($str , 10) , ") " , 3) msgbox(0, '' , '[' & $array[0] & ')", "' & $array[1] & ')", "' & $array[2] & ']') Working perfectly. Why I didn't thinked about it? Thanks. After switching years ago to Linux, sadly I don't use AutoIt anymore. Link to comment Share on other sites More sharing options...
algiuxas Posted October 7, 2017 Author Share Posted October 7, 2017 2 minutes ago, Melba23 said: algiuxas, A simple StringReplace does the trick: $sTransform = "translate(30) rotate(45 50 50) matrix(1,2,3,4,5,6)" $sRequired = '["translate(30)", "rotate(45 50 50)", "matrix(1,2,3,4,5,6)"]' $sChanged = '["' & StringReplace($sTransform, ") ", ')", "') & '"]' ConsoleWrite($sChanged & @CRLF & $sRequired & @CRLF) M23 I was meant that it would split it into array, but thanks anyways for helping After switching years ago to Linux, sadly I don't use AutoIt anymore. Link to comment Share on other sites More sharing options...
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