DecimalFormatSymbols SetGroupingSeparator() Example
Sets the character used for thousands separator.
DecimalFormatSymbolsclass SetGroupingSeparator() method example. This example shows you how to use SetGroupingSeparator() method.This method Sets the character used for thousands separator.
Here is the code:-
/**
* @Program that Sets the character used for thousands separator.
* SetGroupingSeparator.java
* Author:-RoseIndia Team
* Date:-14-Jun-2008
*/
import java.text.*;
public class SetGroupingSeparator {
public static void main(String[] args) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
char c = dfs.getGroupingSeparator();
System.out.println("Character used for thousands separator: " + c);
dfs.setGroupingSeparator('~');
System.out.println("Character used for thousands separator: " +dfs.getGroupingSeparator());
}
} |
Output of the program:-
Character used for thousands separator: ,
Character used for thousands separator: ~ |
|