Coders Packet

Validate Pancard and sort the ID in Java

By Srinivasa V

A Java code to validate whether the id entered is a valid pancard id and sort id in ascending order of numbers and descending order of characters.

This is a Java code which implements the methods to validate the pancard id entered by the user and sort the pancard id if it is a valid id, in the ascending order of strings and numbers in a group.

There are a few consideration. They are:

1) The entered id should be a valid pancard id. ie. it should contain only captial letters  A-Z and numerical values from 0-9.

2) If the id is invalid then it should not sort.

3) If valid then the numerical values in the id should be sorted in ascending order.

4) And the alphabets should be sorted in the descending order.

5) The sort numerical values should be first and sorted alphabet values should be at the end of the string as output.

Download Complete Code


No comments yet