java 如何将数字转换为泰语单词
how to convert numeric to thai language word in java
我使用了以下代码,但它不起作用
import java.text.NumberFormat;
import java.util.Locale;
public class NumToword {
public static void main(String str[]){
String outputString = new String();
Locale[] thaiLocale = {
new Locale("th"),
new Locale("th", "TH"),
new Locale("th", "TH", "TH")
};
for (Locale locale : thaiLocale) {
NumberFormat nf = NumberFormat.getNumberInstance(locale);
outputString = outputString + locale.toString() + ": ";
outputString = outputString + nf.format(573.34) + "\n";
System.out.println("word : "+outputString);
}
}
}
我想你想要
System.out.println("word : "+outputString);
在 for 循环之外并使其相同:http://docs.oracle.com/javase/tutorial/i18n/locale/create.html 删除 "word : "。即:
import java.text.NumberFormat;
import java.util.Locale;
public class NumToword {
public static void main(String str[]){
String outputString = new String();
Locale[] thaiLocale = {
new Locale("th"),
new Locale("th", "TH"),
new Locale("th", "TH", "TH")
};
for (Locale locale : thaiLocale) {
NumberFormat nf = NumberFormat.getNumberInstance(locale);
outputString = outputString + locale.toString() + ": ";
outputString = outputString + nf.format(573.34) + "\n";
}
System.out.println(outputString);
}
}
我使用了以下代码,但它不起作用
import java.text.NumberFormat;
import java.util.Locale;
public class NumToword {
public static void main(String str[]){
String outputString = new String();
Locale[] thaiLocale = {
new Locale("th"),
new Locale("th", "TH"),
new Locale("th", "TH", "TH")
};
for (Locale locale : thaiLocale) {
NumberFormat nf = NumberFormat.getNumberInstance(locale);
outputString = outputString + locale.toString() + ": ";
outputString = outputString + nf.format(573.34) + "\n";
System.out.println("word : "+outputString);
}
}
}
我想你想要
System.out.println("word : "+outputString);
在 for 循环之外并使其相同:http://docs.oracle.com/javase/tutorial/i18n/locale/create.html 删除 "word : "。即:
import java.text.NumberFormat;
import java.util.Locale;
public class NumToword {
public static void main(String str[]){
String outputString = new String();
Locale[] thaiLocale = {
new Locale("th"),
new Locale("th", "TH"),
new Locale("th", "TH", "TH")
};
for (Locale locale : thaiLocale) {
NumberFormat nf = NumberFormat.getNumberInstance(locale);
outputString = outputString + locale.toString() + ": ";
outputString = outputString + nf.format(573.34) + "\n";
}
System.out.println(outputString);
}
}