Array length returns incorrect value

The code loops from the 1st letter of the string (“123 567”) till the last and finds position of the gaps in it (1, which is correct) and the Array length (= number of gaps =4 which is wrong). What am I doing wrong?

Just copy the code in the 1st frame(flash 8) and run it:

var s:String = "123 567";
var cl:String = "";		
var gap:Array = new Array();


for(var i:Number = 0; i<s.length; i++){	
	cl = s.charAt(i);
	if(cl == " "){gap* = (i); trace("gap at position " + i );}			
}	


trace("number of gaps =" + gap.length);