当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Java Locale.FilteringMode valueOf()用法及代码示例


Java中java.util.Locale.FilteringMode枚举的valueOf()方法用于获取此Locale.FilteringMode枚举类型的指定常量的值。此方法将常量名称作为参数。

用法:

public static Locale.FilteringMode valueOf(String name)

参数:此方法接受参数名称,该参数名称是常量名称,该常量名称的值将从Locale.FilteringMode枚举中检索。


返回类型:此方法返回带有指定名称值的Locale.FilteringMode枚举类型的实例。

异常:此方法不会引发任何异常。

程序1:

// Java program to demonstrate 
// the above method 
  
import java.util.*; 
import java.util.Locale.*; 
  
public class LocaleFilteringModeDemo { 
    public static void main(String[] args) 
    { 
  
        String name 
            = "AUTOSELECT_FILTERING"; 
  
        // Getting the constant 
        // of Locale.FilteringMode 
        System.out.println("Locale.FilteringMode"
                           + " value of "
                           + name + ":"
                           + Locale.FilteringMode 
                                 .valueOf(name)); 
    } 
}
输出:
Locale.FilteringMode value of AUTOSELECT_FILTERING:AUTOSELECT_FILTERING

程序2:

// Java program to demonstrate 
// the above method 
  
import java.util.*; 
import java.util.Locale.*; 
  
public class LocaleFilteringModeDemo { 
    public static void main(String[] args) 
    { 
  
        String name 
            = "EXTENDED_FILTERING"; 
  
        // Getting the constant 
        // of Locale.FilteringMode 
        System.out.println("Locale.FilteringMode"
                           + " value of "
                           + name + ":"
                           + Locale.FilteringMode 
                                 .valueOf(name)); 
    } 
}
输出:
Locale.FilteringMode value of EXTENDED_FILTERING:EXTENDED_FILTERING

参考: https://docs.oracle.com/javase/9/docs/api/java/util/Locale.FilteringMode.html#valueOf-java.lang.String-



相关用法


注:本文由纯净天空筛选整理自Code_r大神的英文原创作品 Locale.FilteringMode valueOf() method in Java with Examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。