Better way to format String!?

Hello,

I just finished an application that do some calculations and the end result is displayed on the stage in TextFields. The result string was in need of formating from example: 123456789.01 to 123 456 789.01 so i kinda made a function that format it.

function formatNum(num:Number):String{    
 var count:int;   
 var numString:String = String(num);

 //counting the character before the decimal point
     for (var i:int = 0; i < numString.length; i++){    
        if(numString.charAt(i) == "."){  
            trace("count: " + count); 
            break;       
        }else{    
            count ++;      
        }   
    } 
 
    //calculating the amount of pauses(a.k.a " " )   
   var pauseNum:int = count/3;       

   //inserting the  pauses and updating the String

    for(var p:int =0; p<pauseNum; p++){ 
       numString = numString.substr(0, count -((p+1)*3)) + " " + numString.substr(count -((p+1)*3),numString.length);  
    }    
        //returning formated String.
       // the value is cut 2 characters after the decimal point

       return numString.substr(0,count + pauseNum +3);
}

all this code is used simply :

var val:Number = 123456789.0123
displayTxt.text = formatNum(val);

My question is “Is there a better way to do this formating?”

Thanks in advance
Regards Thovas