Advertisement
Guest User

Untitled

a guest
Jan 8th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. public boolean numCheck(String input, int number)
  2. {
  3.     if(number > input.length())
  4.     {
  5.         // handle the case where the input String length is shorter than the number param
  6.         return false;
  7.     }
  8.     // have to subtract one off the number as charAt is indexed starting at 0
  9.     if(Character.isDigit(input.charAt(number - 1))
  10.     {
  11.         return true;
  12.     }
  13.     return false;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement