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 firstname.lastname@example.org
Please send your review and feedback to email@example.com
Hi everyone, I booked my train ticket even it is in WaitingList. Because, I guessed that, It will get confirmed when chart prepares. Aft...
Hi friends, I have mistakenly typed the ATM pin 3 times at ATM. My ICICI card was blocked. This was the second time, it happened to me. I h...
For the academic purpose i had written a small program in Matlab. I have tried encoding and decoding the image by using Huffman coding. ...