我們通過追加的方式來實現,考慮到我們的數字是四四分組的,所以我們要先實現四位數正確轉換,上述問題解決之後,再列印四位以上數字時,我們就可以通過追加的方式解決五位以上數「萬」字的追加,同時此程式只能對千萬級別以內的數字進行轉換。
public class test02 else if (i == percent / 5) else
}system.out.print("]");
system.out.printf("\t%.2f%%", (float)percent);
}} catch (unsupportedencodingexception e) catch (filenotfoundexception e) catch (ioexception e) catch (interruptedexception e)
}private static string trans_wan(int num)
if (num % 10000 > 0) }}
if (builder.length() == 0)
return builder.tostring();
}private static string trans(int num) ;
stringbuilder builder = new stringbuilder();
int index = -1;
while ((index = builder.indexof(numeric[0], index + 1)) != -1)
}index = 0;
while ((index = builder.indexof("零零", index)) != -1)
if (builder.length() > 1)
if (builder.lastindexof(numeric[0]) == builder.length() - 1)
}if (builder.indexof("一十") == 0)
return builder.tostring();}}
漢字轉換成拼音
c 乙個有用的漢字轉拼音類 c 漢字轉換為拼音的類,含大小寫轉換 因為是靜態函式 呼叫方法很簡單 crazycoderpinyin.convert 瘋狂 如下 using system using system.collections.generic using system.text using ...
C 數字轉換成大寫漢字程式
using system using system.collections.generic using system.text private double j private string numchinesecharacter new string public money double m 判...
Python漢字轉換成拼音
最近在使用python做專案時,需要將漢字轉化成對應的拼音.網上的一些包大多是python2.x的,使用下面這個包,支援python3.6 from xpinyin import pinyin p pinyin default splitter is p.get pinyin u 上海 shang ...