I'm a newbie to Actionscript but have been coding Coldfusion
In my database tables I frequently use a string field to
contain small lists of integer key values. This came about by
Coldfusion's great List functions for handling this type of data.
I'm trying to duplicate some of these list functions in
Actionscript. Most useful to me is the ListFind() which takes a
ListString and searches for a particular integer value.
In actionscript I've coded it as follows:
var stringList:String = '10,11,15,24';
var testInt:Int = 15;
var listArray:Array = stringList.split(',');
if ( listArray.indexOf( testInt.toString() ) > -1 )
then in list;
not in list;
While this works fine, I was still wondering if there was a
way in which I could cast the array elements returned by the split
function so that they would be integer values instead of string
values. This would allow me to remove the .toString() necessary in
the indexOf() function.