Hi all, I have a very long program in javascript that gets a bunch of stats functions on a list (or two lists) of numbers. Currently I am trying to allow for frequencies, so a user could type 1 2 2 2 3 or just 1 2f3 3 to be the same thing; f is frequency and means to repeat the number before the f as many times as the number after. "str" is my string in the code segment below. The idea is to find the first f in the string and get its index (the idx variable), then start there and go backwards until I find a space; once I hit a space, I can get the characters between it and the index of f, and that is the number to be repeated. I then do the same thing, but going forward from the f index, to see how many times I should repeat the number. However, neither for loop is running!! I have never seen a code segment skipped before, unless it is in a conditional statement (which is not the case here). I have the whole thing in a try/catch (not shown), but that is not picking up any errors and the alert to tell me the start and stop variables is working, except both equal 0. If you want to test it, just initialize str to something like 1 2f3 4 and see what happens. Again, this is javascript. //get the first index of "f" var idx=str.indexOf("f"); var start=0; var stop=0; var i=idx; //move backward from there until we hit a space alert("about to loop: "+i+", "+idx); for(i=idx;i==0;i--){ alert("first loop"); //to see if it is ever entered if(str.charAt(i)==" " || i==0){ //space found or start of list, so end alert("getting start"); start=i; break; } } //now do the same thing, but moving forward for(i=idx,l1=str.length;i<l1;i++){ if(str.charAt(i)==" "){ stop=i; break; } } alert(start+" to "+stop); __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind