JoeCool Posted May 16, 2010 Share Posted May 16, 2010 (edited) there it is, 2 silly functions to convert 0 base index array and 1 base index array... i guest the _array UDF should have something like that ... 1base index array is kind of array with array size at position 0 ex. stringSplit #include <Array.au3> func array0ToArray1( byref $a0 ) local $a1[ubound($a0) + 1], $i for $i = 1 to ubound($a0) $a1[$i] = $a0[$i - 1] next $a1[0] = ubound($a0) return( $a1 ) endfunc func array0FromArray1( byref $a1 ) local $a0[$a1[0]], $i for $i = 0 to $a1[0] - 1 $a0[$i] = $a1[$i + 1] next return( $a0 ) endfunc global $a0 global $a1 = stringSplit( "qwerty", "" ) _arrayDisplay($a1, "") $a0 = array0FromArray1( $a1 ) _arrayDisplay($a0, "") $a1 = array0ToArray1( $a0 ) _arrayDisplay($a1, "") Edited May 17, 2010 by JoeCool Link to comment Share on other sites More sharing options...
JoeCool Posted May 18, 2010 Author Share Posted May 18, 2010 bump ! so nobody find this should be in Array UDF ? it is already in my udf anyway Link to comment Share on other sites More sharing options...
Malkey Posted May 18, 2010 Share Posted May 18, 2010 Here is your example rewritten using existing functions already in the UDF include file, Array.au3. #include <Array.au3> Local $a1 = StringSplit("qwerty", "") _ArrayDisplay($a1, "") _ArrayDelete($a1, 0) ; Instead of array0FromArray1( $a1 ) _ArrayDisplay($a1, "") _ArrayInsert($a1, 0, UBound($a1)) ; Instead of array0ToArray1( ) _ArrayDisplay($a1, "") Link to comment Share on other sites More sharing options...
JoeCool Posted May 19, 2010 Author Share Posted May 19, 2010 Here is your example rewritten using existing functions already in the UDF include file, Array.au3. #include <Array.au3> Local $a1 = StringSplit("qwerty", "") _ArrayDisplay($a1, "") _ArrayDelete($a1, 0) ; Instead of array0FromArray1( $a1 ) _ArrayDisplay($a1, "") _ArrayInsert($a1, 0, UBound($a1)) ; Instead of array0ToArray1( ) _ArrayDisplay($a1, "") lol ur right ... I didn't think hard enough I don't use the _array package, i have since long time my own few packages who do all that stuff (array, matrix etc), i was just writing a script for someone and wrote those 2 functions on the fly for him ... i should always think before coding 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