08-21-2023, 12:07 AM
Hi.
I've added some handy stuff to my library for dealing with arrays:
https://github.com/grymmjack/QB64_GJ_LIB/tree/main/ARR
What is in the library? Read the README.md, but:
TYPES SUPPORTED:
Every numeric type contains the following SUBs/FUNCTIONs e.g. ARR_INT.slice for the slice SUB for INTEGER type.
SUBS AND FUNCTIONS FOR NUMERIC TYPES:
SUBS AND FUNCTIONS FOR STRING TYPE:
I've added some handy stuff to my library for dealing with arrays:
https://github.com/grymmjack/QB64_GJ_LIB/tree/main/ARR
What is in the library? Read the README.md, but:
TYPES SUPPORTED:
- _BYTE
- _UNSIGNED _BYTE
- INTEGER
- _UNSIGNED INTEGER
- _INTEGER64
- _UNSIGNED _INTEGER64
- LONG
- _UNSIGNED LONG
- SINGLE
- DOUBLE
- _FLOAT
- STRING
Every numeric type contains the following SUBs/FUNCTIONs e.g. ARR_INT.slice for the slice SUB for INTEGER type.
SUBS AND FUNCTIONS FOR NUMERIC TYPES:
Code: (Select All)
.slice Slice an array from source to destination starting at index and count slices
.push Push a element onto the end of the array
.pop Pop a element off the end of the array
.shift Pop a element off the beginning of the array
.unshift Push a element on the beginning of the array
.copy Copy an array
.join Return array contents as comma delimited string
.new Create new array using comma delimited string
.longest Return the longest element of an array
.shortest Return the shortest element of an array
.math Do math on every element of an array
.min Return minimum element of an array
.max Return maximum element of an array
.first Return 1st element of an array
.last Return last element of an array
.nth Return every nth element of an array
.in Determine if a value exists in an array
.find Find a value in an array and return it's index
.count Return the number of elements in an array
.size Return the size in bytes of all elements in an array
.reverse Reverse the index of elements in an array
.random Return a random element from the array
.sum Return the sum of all elements in an array
.avg Return the average of all elements in an array
.shuffle Randomize the indexes of all elements in an array
.unique Return unique elements in an array
.gt Return elements greater than (>) value in an array
.gte Return elements greater than or equal (>=) value in an array
.lt Return elements less than (<>=) value in an array
.lte Return elements less than or equal (<>=) value in an array
.replace Replace elements in array with replacement value
.insert Insert element in an array at index
.remove Remove element in an array at index
.odd Return odd numbered indexed elements in an array
.even Return even numbered indexed elements in an array
.mod Return evenly divisible by n numbered indexed elements in an array
.between Return elements between a start and end index in an array
.sort Sort elements of an array in ascending order
.rsort Sort elements of an array in desscending order
SUBS AND FUNCTIONS FOR STRING TYPE:
Code: (Select All)
.slice Slice an array from source to destination starting at index and count slices
.push Push a element onto the end of the array
.pop Pop a element off the end of the array
.shift Pop a element off the beginning of the array
.unshift Push a element on the beginning of the array
.copy Copy an array
.join Return array contents as comma delimited string
.new Create new array using comma delimited string
.longest Return the longest element of an array
.shortest Return the shortest element of an array
.first Return 1st element of an array
.last Return last element of an array
.nth Return every nth element of an array
.in Determine if a value exists in an array
.find Find a value in an array and return it's index
.count Return the number of elements in an array
.size Return the size in bytes of all elements in an array
.reverse Reverse the index of elements in an array
.random Return a random element from the array
.shuffle Randomize the indexes of all elements in an array
.unique Return unique elements in an array
.replace Replace elements in array with replacement value
.insert Insert element in an array at index
.remove Remove element in an array at index
.odd Return odd numbered indexed elements in an array
.even Return even numbered indexed elements in an array
.mod Return evenly divisible by n numbered indexed elements in an array
.between Return elements between a start and end index in an array
.sort Sort elements of an array in ascending order
.rsort Sort elements of an array in desscending order