Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flash General Questions > Other Flash General Questions

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-29-2002, 12:11 PM   #1
manuel alarcon
Registered User
 
Join Date: Oct 2002
Posts: 2
Post recognize a character in input field

Hi there. A friend of mine needs to know (me too, indeed) how to do this:

she has an app where do a little math: sum 1.5+1.3=2.5

but, she wants 2,5 as a correct answer too...in fact, any value whith a comma in it... i think the . has to be recognized and changed to , or viceversa...but we dont know the syntax...

can anybody help?

thanks, greetings from chile
manuel alarcon is offline   Reply With Quote
Old 10-29-2002, 12:53 PM   #2
jimburton
no sleep til bedtime
 
jimburton's Avatar
 
Join Date: May 2001
Location: Brighton
Posts: 1,322
Default

this will do it:

ActionScript Code:
String.prototype.replace = function(s,r) { //s is the substring you're looking for //r is what you want to replace it with var a = this.split(s); return a.join(r); } myDodgyNum = "2,5"; myNiceNum = myDodgyNum.replace(',','.');
jimburton is offline   Reply With Quote
Old 10-29-2002, 01:29 PM   #3
manuel alarcon
Registered User
 
Join Date: Oct 2002
Posts: 2
Default wow...thanks

surprisingly fast....and accurate...it worked perfectly. thanks
manuel alarcon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:36 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.