-неизвестно

 -Поиск по дневнику

Поиск сообщений в ATUM

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 17.02.2006
Записей:
Комментариев:
Написано: 1139


города - ujhjlf

+ в цитатник

Cообщение скрыто для удобства комментирования.
Прочитать сообщение


ATUM   обратиться по имени Среда, 13 Марта 2013 г. 17:59 (ссылка)
public class CityParser {

   public static final String strR ="ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮйцукенгшщзхъфывапролджэячсмитьбю";
   public static final String strE ="QWERTYUIOP[]ASDFGHJKL;'ZXCVBNM,.qwertyuiop[]asdfghjkl;'zxcvbnm,.";


  public static final char[][] chr = new char[strR.length() + 1][2];

  static {
    for (int i = 0; i < strR.length(); i++) {
      chr[i][0] = strR.charAt(i);
      chr[i][1] = strE.charAt(i);

    }
  }
  
  public static String getChar(String str){
    StringBuilder sb = new StringBuilder();
    int l = str.length();
    for (int i = 0 ; i< l ;i++) {
      char ch = str.charAt(i); 
    for (char[] cs : chr) {
      if(cs[0] == ch){
        sb.append(cs[1]);
      break;
      }
    }
    }
    
    return sb.toString();
  }
  
  public static void main(String[] args) throws FileNotFoundException, IOException {
  

    URL url = CityParser.class.getResource("city.log");
    File file = new File(url.getFile());
    
    Scanner scanner = new Scanner(file);
    
    while(scanner.hasNextLine()){
       String rcity = scanner.nextLine().trim();
       String ecity = getChar(rcity);
       if(ecity.length()>7 && ecity.contains(".")){
       System.out.println(rcity + " - " + ecity);
       }
    }
  }
}


* This source code was highlighted with Source Code Highlighter.
Ответить С цитатой В цитатник
 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку