Skip to content

Commit

Permalink
replace useless stringbuffer with string
Browse files Browse the repository at this point in the history
  • Loading branch information
rx_jinjunjie committed Nov 23, 2014
1 parent 1673c99 commit c1b2266
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/main/java/net/sourceforge/pinyin4j/PinyinFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,9 @@ private static String convertToneNumber2ToneMark(final String pinyinStr) {

char markedVowel = allMarkedVowelStr.charAt(vowelLocation);

StringBuffer resultBuffer = new StringBuffer();

resultBuffer.append(lowerCasePinyinStr.substring(0, indexOfUnmarkedVowel).replaceAll("v",
"ü"));
resultBuffer.append(markedVowel);
resultBuffer.append(lowerCasePinyinStr.substring(indexOfUnmarkedVowel + 1,
lowerCasePinyinStr.length() - 1).replaceAll("v", "ü"));

return resultBuffer.toString();
return lowerCasePinyinStr.substring(0, indexOfUnmarkedVowel).replaceAll("v",
"ü") + markedVowel + lowerCasePinyinStr.substring(indexOfUnmarkedVowel + 1,
lowerCasePinyinStr.length() - 1).replaceAll("v", "ü");

} else
// error happens in the procedure of locating vowel
Expand Down

0 comments on commit c1b2266

Please sign in to comment.