Tuesday, April 30, 2013

[android-developers] Re: validating indian currency in java using regular expressions

I would say the pattern would probably be this:

\d*\.\d\d

Of course, all \ will become \\.

So…

boolean is_valid_currency(String yourString)
{

   String regEx = "\\d*\\.\\d\\d";

   boolean matches = yourString.matches(regEx);

   return matches;
}


Thanks.



On Monday, April 29, 2013 6:27:23 AM UTC-5, SIVAKUMAR.J wrote:
Dear All,

  I want to get input from user and valid it is a india currency. for example the correct ones is 12.34,1010.23,etc
  the wrong ones is 12.999,12.99.99,etc.
  After decimal if it is more than 3 digits means it is wrong.
  Please provide the ideas to valid the above things in java.

--
Thanks & Regards,
SIVAKUMAR.J

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment