@Override
  public void run() {
    char c;

    try {
      while (running) {
        char_recieved = telnetHelper.read();
        c = (char) char_recieved;
        c = ansiCoding(c);
        if (ansiTransmitCode) {
          if (ansiCode.toString().charAt(ansiCode.toString().length() - 1) == '\n') {
            telnetHelper.addInputStringFragment(ansiCode.toString(), true);
          } else {
            telnetHelper.addInputStringFragment(ansiCode.toString(), false);
          }
          ansiCode.delete(0, ansiCode.length());
          ansiTransmitCode = false;
        }
        if (c == '\r') {
          // Suppress \r characters
        } else if (c == '\n') {
          telnetHelper.addInputStringFragment(java.lang.Character.toString(c), true);
        } else if (char_recieved > 0) {
          telnetHelper.addInputStringFragment(java.lang.Character.toString(c), false);
        }
        LogWriter.write(EnumLogType.TELNET, java.lang.Character.toString(c));
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public static void findTExtLetters(String letterToFind, String filePath) throws IOException {

    BufferedReader br = new BufferedReader(new FileReader(new File(filePath)));
    boolean foundIt = false;
    int i = 1;
    String[] letterToFindarray = letterToFind.split("");

    for (String line = br.readLine(); line != null; line = br.readLine()) {

      String[] letterarray = line.split("");

      for (int j = 0; j < letterarray.length; j++) {
        for (int x = 0; x < letterToFindarray.length; x++) {
          if (letterToFindarray[x].equals(letterarray[j])) {
            System.out.println("Egyezes a(z)" + i + ". sor, " + (j + 1) + ". karakterrel");
            foundIt = true;
          } else {
            char m = letterToFindarray[x].charAt(0);
            int o = (int) m;
            if (o < 95) { // nagy betűt keresek és kis betű a keresendőben
              char n = letterarray[j].charAt(0);
              int p = (int) n;
              p = p - 32;
              n = (char) p;
              String backToString = Character.toString(n);
              if (letterToFindarray[x].equals(backToString)) {
                System.out.println("Egyezes a(z)" + i + ". sor, " + (j + 1) + ". karakterrel");
                foundIt = true;
              }
            } else { //// kis betűt keresek és nagy betű a keresendőben
              char n = letterarray[j].charAt(0);
              int p = (int) n;
              p = p + 32;
              n = (char) p;
              String backToString = Character.toString(n);
              if (letterToFindarray[x].equals(backToString)) {
                System.out.println("Egyezes a(z)" + i + ". sor, " + (j + 1) + ". karakterrel");
                foundIt = true;
              }
            }
          }
        }
      }
      i++;
    }
    if (!foundIt) {
      System.out.println("Nincs ilyen szo");
    }
  }
Beispiel #3
0
  /**
   * 将字符串中的中文转化为拼音,其他字符不变
   *
   * @param inputString
   * @return
   */
  public static String getPingYin(String inputString) {
    HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
    format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    format.setVCharType(HanyuPinyinVCharType.WITH_V);

    char[] input = inputString.trim().toCharArray();
    String output = "";

    try {
      for (int i = 0; i < input.length; i++) {
        if (java.lang.Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) {
          String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format);
          output += temp[0];
        } else output += java.lang.Character.toString(input[i]);
      }
    } catch (BadHanyuPinyinOutputFormatCombination e) {
      e.printStackTrace();
    }
    return output;
  }
 private boolean asciiEqual(String[] letterToFindarray, String[] letterarray, int stepcount) {
   char m = letterToFindarray[stepcount].charAt(0);
   int o = (int) m;
   char n = letterarray[stepcount].charAt(0);
   int p = (int) n;
   if (o < 95) { // nagy betűt keresek és kis betű a keresendőben
     p = p - 32;
   } else { //// kis betűt keresek és nagy betű a keresendőben
     p = p + 32;
   }
   n = (char) p;
   String backToString = Character.toString(n);
   return letterToFindarray[stepcount].equals(backToString);
 }
Beispiel #5
0
  public Note prevHalfStep() {
    // If the next note a half step away, return it
    if (this.nextInterval == 0.5) {
      return this.nextNote();
    }
    ;

    // Otherwise, if the length of the note name is > 1, we have a sharp
    if (this.noteName.length() > 1) {
      String startingLetter = Character.toString(this.noteName.charAt(0));
      return new Note(startingLetter);
    } else {
      return new Note(Note.lookUp(this.noteName)[3] + "#");
    }
  }
Beispiel #6
0
 public Note prevNote() {
   String startingLetter = Character.toString(this.noteName.charAt(0));
   return new Note(Note.lookUp(startingLetter)[3]);
 }
Beispiel #7
0
 /* Returns a string with the character given by the numeric code.
  */
 public static SchemaString charFromCode(SchemaTypeNumber value) {
   Character c = new Character((char) value.intValue());
   return new SchemaString(c.toString());
 }
 public java.lang.String toString() {
   return java.lang.Character.toString(value);
 }
  public static void findTextWordNoCaps(String wordToFind, String filePath) throws IOException {

    BufferedReader br = new BufferedReader(new FileReader(new File(filePath)));
    boolean foundIt = false;
    int i = 1;

    String[] wordToFindarray = wordToFind.split(" ");

    for (String line = br.readLine(); line != null; line = br.readLine()) {
      String[] wordarray = line.split(" ");

      for (int j = 0; j < wordarray.length; j++) {
        for (int x = 0; x < wordToFindarray.length; x++) {
          if (wordToFindarray[x].equals(wordarray[j])) {
            System.out.println("Egyezes a(z)" + i + ". sor, " + (j + 1) + ". szavaval");
            foundIt = true;
            System.out.println(wordarray[j]);
          } else {

            String[] letterarray = wordarray[j].split("");
            String[] letterToFindarray = wordToFindarray[x].split("");

            if (letterarray.length == letterToFindarray.length) {
              int foundCount = 0;
              int stepcount = 0;
              do {
                if (letterToFindarray[stepcount].equals(letterarray[stepcount])) {
                  foundCount++;
                } else {
                  char m = letterToFindarray[stepcount].charAt(0);
                  int o = (int) m;
                  if (o < 95) { // nagy betűt keresek és kis betű a keresendőben
                    char n = letterarray[stepcount].charAt(0);
                    int p = (int) n;
                    p = p - 32;
                    n = (char) p;
                    String backToString = Character.toString(n);
                    if (letterToFindarray[stepcount].equals(backToString)) {
                      foundCount++;
                    }
                  } else { //// kis betűt keresek és nagy betű a keresendőben
                    char n = letterarray[stepcount].charAt(0);
                    int p = (int) n;
                    p = p + 32;
                    n = (char) p;
                    String backToString = Character.toString(n);
                    if (letterToFindarray[stepcount].equals(backToString)) {
                      foundCount++;
                    }
                  }
                }
                stepcount++;
              } while ((stepcount == foundCount) && (stepcount < letterToFindarray.length));
              if (stepcount == foundCount) {
                foundIt = true;
                System.out.println("Egyezes a(z)" + i + ". sor, " + (j + 1) + ". szavaval");
                System.out.println(wordarray[j]);
              }
            }
          }
        }
      }
      i++;
    }
    if (!foundIt) {

      System.out.println("Nincs ilyen szo");
    }
  }