Advertisement
S370191

NUMBER

Oct 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class Number {
  5.  
  6.  
  7.  
  8. public static void main(String[] args) throws IOException {
  9.  
  10.  
  11.  
  12. getFile();
  13.  
  14. }
  15. public static void getFile() throws IOException {
  16.  
  17. File input = new File("AlphabeticPhoneNumbers.txt");
  18. Scanner inputFile = new Scanner(input);
  19.  
  20.  
  21. while (inputFile.hasNext()) {
  22. Scanner slashScan = new Scanner(inputFile.nextLine());
  23. String line = inputFile.nextLine();
  24.  
  25.  
  26. slashScan.close();
  27.  
  28.  
  29. }
  30. inputFile.close();
  31.  
  32.  
  33.  
  34. }
  35.  
  36. public static char getPhoneNumber(String input){
  37. char c;
  38. int counter = 0;
  39. c = input.toLowerCase().charAt(0);
  40.  
  41. if (c == 'F' || c == 'B' || c == 'C'){
  42.  
  43.  
  44.  
  45. }
  46. return c;
  47. }// End of full_number function
  48.  
  49.  
  50. private static boolean isVaild(String input){
  51.  
  52. String phoneNumber = input;
  53. int length = phoneNumber.length();
  54. char c;
  55. int counter = 0;
  56.  
  57. if(length == 12 || length == 14){
  58.  
  59.  
  60. do{
  61.  
  62. c = phoneNumber.charAt(counter);
  63.  
  64. if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '-'){
  65. counter ++;
  66.  
  67. }
  68. else{
  69. return false;
  70. }
  71. }
  72. while (counter < length - 1);
  73.  
  74. }else {
  75.  
  76. return false;
  77. }
  78.  
  79.  
  80. return true;
  81.  
  82. }
  83.  
  84.  
  85.  
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement