Created
January 13, 2014 08:33
-
-
Save currencysecrets/8396591 to your computer and use it in GitHub Desktop.
Amibroker utility function on converting array to string - helpful for debugging just what's in those arrays. Needs the countArray functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EnableScript("JScript"); | |
<% | |
function getArrayLength( a ) { | |
x = VBArray( a ).toArray(); | |
for ( y = 0; y < x.length; y += 1 ) { | |
if ( x[y] == undefined ) break; | |
} | |
return y; | |
} | |
%> | |
function arrCount( arr ) { | |
scr = GetScriptObject(); | |
a = 0; | |
if ( !IsNull( BeginValue( arr ) ) ) a = scr.getArrayLength( arr ); | |
return a; | |
} | |
function arrayToStr( arr ) { | |
result = "["; | |
for ( i = 1; i < arrCount( arr ); i += 1 ) { | |
result += arr[i]; | |
if ( i + 1 < arrCount( arr ) ) result += ","; | |
} | |
result += "]"; | |
return result; | |
} | |
// usage | |
// _TRACE( arrayToStr( L ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment