Locale getDisplayScript() in Java

getDisplayScript(): This method is available in java.util.Locale class of Java.

Syntax:

String java.util.Locale.getDisplayScript()

This method returns a name for the locale's script that is appropriate for display to the user. If possible, the name will be localized for the default DISPLAY locale.

Note: Returns the empty string if this locale doesn't specify a script code.

Returns: the display name of the script code for the current default DISPLAY locale.

For Example:

Locale locale = Locale.CANADA_FRENCH

locale.getDisplayScript() = > It return empty String.

Approach

Java

import java.util.Locale;

public class LocalegetDisplayScript {
    public static void main(String[] args) {

        Locale locale = Locale.CANADA_FRENCH;

        System.out.println("Script is " +
 locale.getDisplayScript());
    }
}

Output:

Script is 

No comments:

Post a Comment