all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

strip commas from VAR..


strip commas from VAR.. th3monk3y
4/8/2004 10:06:38 PM
flash actionscript:
Hey all,
I have some numeric variables being pulled from a database via php.
I need to stip the commas from them so I can add them together... currently if
I try to add them, it just shows them as an "array"... _root.deeds.td1 +
_root.deeds.td2

ends up as: 140,000200,000
rather than: 340,000
Regards,
Paul
Re: strip commas from VAR.. th3monk3y
4/9/2004 1:08:13 AM
so I found a way to do it in php...

<?
$search_string = "125,000";
$new_string = str_replace(",","",$search_string);
echo $new_string;
?>

returns: 125000

I am hoping someone can help me do this in Actionscript...
thanks,
-Paul
Re: strip commas from VAR.. th3monk3y
4/9/2004 1:45:29 AM
just in case anyone else needs to do this... I found this example and made it
work for me...

String.prototype.searchReplace=function(find,replace) {
return this.split( find ).join( replace);
}

var myString = "Jaaaaaaaaaaaaazzzz...";
trace(myString);// Jaaaaaaaaaaaaazzzz...
var newString = myString.searchReplace("a","e");
trace( newString ); // Jeeeeeeeeeeeeezzzz...


paul
AddThis Social Bookmark Button