Hi everyone,
Today, I have come across one situation where money(currency) field has to be validated. According to Indian currency, we will consider 2 digits after period(.)
When I want to validate the particular field, I have tried with substring() and indexOf() methods. But I am not getting the expected result. I want to have the output ending with .##, So, I have come to know about NumberFormat class from java.text package.
Here goes sample code with output:
Input: 234 / 234.232 / 234.3
Output: 234.0 / 234.23 / 234.3
NumberFormat nf = new DecimalFormat(".##");
System.out.println("Input: "+234+"Output: "+nf.format(234));
Please send your feedback and queries to psrdotcom@gmail.com
Subscribe to:
Post Comments (Atom)
Featured Post
Java Introdcution
Please send your review and feedback to psrdotcom@gmail.com
-
Hi all, Today, I'll explain how to uninstall completely the openjdk from the RedHat Enterprise Linux (RHEL) machine. Some of the sof...
-
Hi folks, Today we are going to see, how we can run or deploy the Go (Golang) project in IIS. Development Create your Golang project with w...
-
Hi friends, I have updated my Aadhaar details from Aadhaar update center. It is mentioned that within 72 hours, my details will be update...
No comments:
Post a Comment