Advertisement
iamaamir

ShortName

Aug 16th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1.     public static void main(String[] args) {
  2.        
  3.         String name = "Avul Pakir Jainulabdeen Abdul kalam";
  4.         String[] splitedName = name.split("\\s");
  5.         String shortName = "";
  6.        
  7.         int len = (splitedName.length - 1);
  8.  
  9.         for (int i = 0; i < len; i++)
  10.             shortName = shortName.concat(splitedName[i].charAt(0) + ". ");
  11.        
  12.         shortName = shortName.concat(splitedName[len]);
  13.         System.out.println(shortName.toUpperCase());
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement