//StringFormat.java file
import java.util.*;public class StringFormat{ public static void main(String[] args){ double e = Math.E; System.out.format("%f%n", e); System.out.format(Locale.GERMANY, "%-10.4f%n%n", e); //指定本地为德国(GERMANY) }}
The output result of the above code example is:
2.718282 2,7183
The above is the Java example - string formatting content, more For related content, please pay attention to the PHP Chinese website (www.php.cn)!