熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

Java 源代碼 計算出拼音的聲調字母是哪個

2022-06-13   來源: Java核心技術 

  import javaio*;//導入操作要用到的類

  public class main {

  public static void main(String args[]) {

  File file = new File(c:/testtxt// 源文件位置

  FileReader fr;

  try {

  fr = new FileReader(file)

  BufferedReader in = new BufferedReader(fr)// 包裝文件輸入流可整行讀取

  String line;

  try {

  while ((line = inreadLine()) != null) {

  String a = pinyin(line)

  int shengdiaoLetter = IntegerparseInt(asubstring(

  alength() alength()))

  a = asubstring( alength() ) +

  + asubstring(shengdiaoLetter shengdiaoLetter +

  Systemoutprintln(a)

  }

  } catch (IOException e) {

  // TODO Autogenerated catch block

  eprintStackTrace()

  }

  } catch (FileNotFoundException e) {

  // TODO Autogenerated catch block

  eprintStackTrace()

  }// 創建文件輸入流

  }

  private static String pinyin(String input) {

  int position = ;

  int onlyaeiou = ;

  input = inputtoLowerCase()

  // 單個韻母不必說 (單個的韻母當然就標它上面了)

  if (ntains(a)) {

  onlyaeiou++;

  }

  if (ntains(e)) {

  onlyaeiou++;

  }

  if (ntains(i)) {

  onlyaeiou++;

  }

  if (ntains(o)) {

  onlyaeiou++;

  }

  if (ntains(u)) {

  onlyaeiou++;

  }

  if (ntains(v)) {

  onlyaeiou++;

  }

  if (onlyaeiou == ) {

  if (ntains(a)) {

  position = inputindexOf(a

  }

  if (ntains(e)) {

  position = inputindexOf(e

  }

  if (ntains(i)) {

  position = inputindexOf(i

  }

  if (ntains(o)) {

  position = inputindexOf(o

  }

  if (ntains(u)) {

  position = inputindexOf(u

  }

  if (ntains(v)) {

  position = inputindexOf(v

  }

  return input + position;

  }

  if (ntains(a)) {

  position = inputindexOf(a

  return input + position;

  }

  // 沒有a母找o e

  else if (ntains(o)) {

  position = inputindexOf(o

  return input + position;

  } else if (ntains(e)) {

  position = inputindexOf(e

  return input + position;

  }

  // iu 並列標在後

  if (ntains(iu)) {

  position = inputindexOf(iu) + ;

  return input + position;

  }

  if (ntains(a)) {

  position = inputindexOf(a

  return input + position;

  }

  if (ntains(e)) {

  position = inputindexOf(e

  return input + position;

  }

  if (ntains(i)) {

  position = inputindexOf(i

  return input + position;

  }

  if (ntains(o)) {

  position = inputindexOf(o

  return input + position;

  }

  if (ntains(u)) {

  position = inputindexOf(u

  return input + position;

  }

  if (ntains(v)) {

  position = inputindexOf(v

  return input + position;

  }

  return input;

  }

  }


From:http://tw.wingwit.com/Article/program/Java/hx/201311/25755.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.