GaryC Posted February 28, 2012 Share Posted February 28, 2012 This UDF contains modifications of functions in Array.au3 as well as a couple of other functions that ended up in the file I use in a couple of my projects. I replaced the "_" prefix with "my" to avoid name collisions. There is also commented-out test code for two of the functions. I hope the tests can serve as examples. MyArrayInsert - _ArrayInsert modified to allow insertion of an array into another array, also appending to an array. MyArrayBinarySearch - _ArrayBinarySearch modified to return the index at which to insert a not-found item, also to search 2d arrays. MyArrayAdd - wrapper for _ArrayAdd that creates the array if the specified variable isn't an array. This could be added to _ArrayAdd but the wrapper was a quick way to implement it before I pulled it out into a library. MyArrayPop - _ArrayPop modified to pop multiple items. This might not be useful very often. MyArrayBinarySearch and MyArrayInsert should be backward compatible with the functions they replace. I kept and modified the header blocks (I hope) appropriately. MyArrayAdd, MyArrayPop, Display2d, and the test functions don't have standard header comment blocks. Display2d returns a string containing a display of a 2d array. I use it for debugging in some of my code, but it may not be of much interest to anyone else. It certainly needs to be renamed, which I haven't done so I don't have to change my code base :-). The functions are in attached file myarray_d.au3. Attached file _ArrayBinarySearch.au3 is a modified example file for MyArrayBinarySearch. Enjoy! GaryCmyarray_d.au3_ArrayBinarySearch.au3 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