/* * clearIntArray * This function deletes all items in array (sets it to 0) and resizes array according to size (default = 1). * @param int& theArray - passing the array by reference * @param int size - size of the array (default = 1) * @return int blank array of size */ void clearIntArray( int& theArray[], int size = 0 ) { ArrayResize( theArray, size ); if ( size > 0 ) { ArrayInitialize( theArray, 0 ); } return( theArray ); } /* * clearDoubleArray * This function deletes all items in array (sets it to 0) and resizes array according to size (default = 1). * @param int& theArray - passing the array by reference * @param int size - size of the array (default = 1) * @return int blank array of size */ void clearDoubleArray( double& theArray[], int size = 0 ) { ArrayResize( theArray, size ); if ( size > 0 ) { ArrayInitialize( theArray, 0 ); } return( theArray ); } /* * clearStringArray * This function deletes all items in array (sets it to 0) and resizes array according to size (default = 1). * @param string& theArray - passing the array by reference * @param int size - size of the array (default = 1) * @return int blank array of size */ void clearStringArray( string& theArray[], int size = 0 ) { ArrayResize( theArray, size ); if ( size > 0 ) { ArrayInitialize( theArray, 0 ); } return( theArray ); } /* * addToIntArray * This function appends an integer value to an integer array. * @param int& theArray - passing the array by reference * @param int val - the item to be appended (no checks on val) * @return int the array with appended value */ void addToIntArray( int& theArray[], int val ) { ArrayResize( theArray, ArraySize( theArray ) + 1 ); theArray[ ArraySize( theArray ) - 1 ] = val; return( theArray ); } /* * addToDoubleArray * This function appends a double value to a double array. * @param double& theArray - passing the array by reference * @param double val - the item to be appended (no checks on val) * @return double the array with appended value */ void addToDoubleArray( double& theArray[], double val ) { ArrayResize( theArray, ArraySize( theArray ) + 1 ); theArray[ ArraySize( theArray ) - 1 ] = val; return( theArray ); } /* * addToStringArray * This function appends a string value to a string array. * @param string& theArray - passing the array by reference * @param string val - the item to be appended (no checks on val) * @return string the array with appended value */ void addToIntArray( string& theArray[], string val ) { ArrayResize( theArray, ArraySize( theArray ) + 1 ); theArray[ ArraySize( theArray ) - 1 ] = val; return( theArray ); } /* * arrayIntToStr * This function outputs a one-dimensional array to a string separated by concatWith variable. * @param int theArray - the array of items you seek to print * @param string concatWith - the string you wish to concatenate items with (default = ",") * @return string the array concatenated to a string */ void arrayIntToStr( int theArray[], string concatWith = "," ) { string s = ""; int a = ArraySize( theArray ); for( int i = 0; i < a; i++ ) { s = StringConcatenate( s, theArray[i], concatWith ); } s = StringSubstr( s, 0, StringLen(s) - StringLen( concatWith ) ); return ( s ); } /* * arrayDoubleToStr * This function outputs a one-dimensional array to a string separated by concatWith variable. * @param double theArray - the array of items you seek to print * @param string concatWith - the string you wish to concatenate items with (default = ",") * @return string the array concatenated to a string */ void arrayDoubleToStr( double theArray[], string concatWith = "," ) { string s = ""; int a = ArraySize( theArray ); for( int i = 0; i < a; i++ ) { s = StringConcatenate( s, theArray[i], concatWith ); } s = StringSubstr( s, 0, StringLen(s) - StringLen( concatWith ) ); return ( s ); } /* * arrayStringToStr * This function outputs a one-dimensional array to a string separated by concatWith variable. * @param string theArray - the array of items you seek to print * @param string concatWith - the string you wish to concatenate items with (default = ",") * @return string the array concatenated to a string */ void arrayStringToStr( string theArray[], string concatWith = "," ) { string s = ""; int a = ArraySize( theArray ); for( int i = 0; i < a; i++ ) { s = StringConcatenate( s, theArray[i], concatWith ); } s = StringSubstr( s, 0, StringLen(s) - StringLen( concatWith ) ); return ( s ); }