Skip to main content
May 12, 2008
Question

making sure my 3rd letter is one , or .

  • May 12, 2008
  • 4 replies
  • 353 views
Hello,

I'm having big trouble trying to make sure user input one . (dot) or , (comma) in 3rd place on sentence, how can I do that?

I'm using this:

var letra:String = a_checar.charAt(2);
if ((letra != ",") || (letra != ".")) {
getURL("javascript:alert('erro no 3º digito')");
trace(letra);
return;
}

but this does not work, even if user enters per example 14,56, I got error on 3rd letter

Any help please?

Thanks
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
May 12, 2008
lol. he should get the right idea.
Inspiring
May 12, 2008
No text available
kglad
Community Expert
Community Expert
May 12, 2008
use && instead of ||.
Inspiring
May 12, 2008
>> if ((letra != ",") || (letra != ".")) {

Should be: if ((letra != ",") && (letra != ".")) {




--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/