PDA

View Full Version : array :: string length


scroots
12-30-2002, 08:47 PM
i have my array
var x=new Array()
x[0]="ghhh0 \f "
x[1]="ggggggg1 \f "
x[2]="g2 \f"
x[3]="3gggggg \f"
x[4]="4 \f"
x[5]="gggggggg5 \f"


how can i find the length of say x[5] so it returns 12 and for x[4] it returns 4?

thanks

scroots

chrismiceli
12-30-2002, 08:56 PM
var x=new Array()
x[0]="ghhh0 \f "
x[1]="ggggggg1 \f "
x[2]="g2 \f"
x[3]="3gggggg \f"
x[4]="4 \f"
x[5]="gggggggg5 \f"
alert(x[5].length);
that may be problematic because you are escaping f, you can't find the length to include the f because it is used to format the string, it is not part of the string itself.

scroots
12-30-2002, 09:01 PM
thank you it has fixed a major problem.

scroots