Deye Posted October 17, 2018 Posted October 17, 2018 hi, @not knowing how to go about it, weather i should do a patch job or maybe its easier to get it done with a core function (didn't go through it .. ) so I'm throwing this into the air All I figured out for now is that if instances with ":\" go to end it fixes some case issues (will need to recall: as to why.) example: sorted list with $iDescending: H:\ False False False Downloads Documents Control Panel\Network and Internet\Network Connections C:\Users\ C:\ what can I amend in so all instances with ":\" get glued to the end of the array TIA Deye
czardas Posted October 17, 2018 Author Posted October 17, 2018 (edited) @Deye This question should have been posted in GH&S. Here's a quick and simple method which does not verify whether paths exist, nor does it verify syntax. It might do what you want, or at least give you some ideas. #include <Array.au3> Local $aTest = _ ['H:\', _ 'False', _ 'False', _ 'False', _ 'Downloads', _ 'Documents', _ 'Control Panel\Network and Internet\Network Connections', _ 'C:\Users\', _ 'C:\'] _ArrayDisplay($aTest, 'Before') For $i = 0 To UBound($aTest) -1 If StringRegExp($aTest[$i], '(\A[A-Z]\:\\)') Then $aTest[$i] = 'z' & $aTest[$i] Else $aTest[$i] = 'a' & $aTest[$i] EndIf Next _ArraySort($aTest) For $i = 0 To UBound($aTest) -1 $aTest[$i] = StringTrimLeft($aTest[$i], 1) Next _ArrayDisplay($aTest, 'After') Edited October 17, 2018 by czardas Deye 1 operator64 ArrayWorkshop
iamtheky Posted October 18, 2018 Posted October 18, 2018 (edited) so here is some madness to extract the target from source, sort both arrays independently, and then glue them back together. #include<array.au3> local $array = ['H:\' , 'False' , 'False' , 'False' , 'Downloads' , 'Documents' , 'Control Panel\Network and Internet\Network Connections' , 'C:\Users\' , 'C:\'] for $i = 0 to ubound($array) - 1 $array[$i] = StringReverse($array[$i]) Next $arraysort = _ArraySort($array , 1) for $i = 0 to ubound($array) - 1 $array[$i] = StringReverse($array[$i]) Next $aFound = _ArrayFindAll($array , ":\", 0 , 0 ,0 , 1) $extract = _ArrayExtract($array , $aFound[0]) _ArrayInsert($aFound , 0 , ubound($aFound)) _ArrayDelete($array , $aFound) _ArraySort($array) _ArraySort($extract) _ArrayConcatenate($array , $extract) _ArrayDisplay($array) Edited October 18, 2018 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
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