メソッドの目的は、次のような文字列の音訳です: афиваў => afivaw. 問題はcharAt
、'ш' => "sh" という 2 つの記号として音訳する必要がある文字があるため、メソッドを使用して再定義できないことです。私はこれを試します:
public static String belrusToEngTranlit (String text){
char[] abcCyr = {'a','б','в','г','д','ё','ж','з','и','к','л','м','н','п','р','с','т','у','ў','ф','х','ц','ш','щ','ы','э','ю','я'};
String[] abcLat = {"a","b","v","g","d","jo","zh","z","i","k","l","m","n","p","r","s","t","u","w","f","h","ts","sh","sch","","e","ju","ja"};
for (int i = 0; i < text.length(); i++) {
for(int x = 0; x < abcCyr.length; x++ )
if (text.charAt(i) == abcCyr[x]) {
text.charAt(i) = abcLat[x];
}
}
return text;
}
以外の何かを私に勧めることができますcharAt
か?