Package com.ibm.icu.impl.number
Enum DecimalFormatProperties.ParseMode
- java.lang.Object
-
- java.lang.Enum<DecimalFormatProperties.ParseMode>
-
- com.ibm.icu.impl.number.DecimalFormatProperties.ParseMode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<DecimalFormatProperties.ParseMode>
- Enclosing class:
- DecimalFormatProperties
public static enum DecimalFormatProperties.ParseMode extends java.lang.Enum<DecimalFormatProperties.ParseMode>
Controls the set of rules for parsing a string from the old DecimalFormat API.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JAVA_COMPATIBILITY
Internal parse mode for increased compatibility with java.text.DecimalFormat.LENIENT
Lenient mode should be used if you want to accept malformed user input.STRICT
Strict mode should be used if you want to require that the input is well-formed.
-
Constructor Summary
Constructors Modifier Constructor Description private
ParseMode()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DecimalFormatProperties.ParseMode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static DecimalFormatProperties.ParseMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LENIENT
public static final DecimalFormatProperties.ParseMode LENIENT
Lenient mode should be used if you want to accept malformed user input. It will use heuristics to attempt to parse through typographical errors in the string.
-
STRICT
public static final DecimalFormatProperties.ParseMode STRICT
Strict mode should be used if you want to require that the input is well-formed. More specifically, it differs from lenient mode in the following ways:- Grouping widths must match the grouping settings. For example, "12,3,45" will fail if the grouping width is 3, as in the pattern "#,##0".
- The string must contain a complete prefix and suffix. For example, if the pattern is "{#};(#)", then "{123}" or "(123)" would match, but "{123", "123}", and "123" would all fail. (The latter strings would be accepted in lenient mode.)
- Whitespace may not appear at arbitrary places in the string. In lenient mode, whitespace is allowed to occur arbitrarily before and after prefixes and exponent separators.
- Leading grouping separators are not allowed, as in ",123".
- Minus and plus signs can only appear if specified in the pattern. In lenient mode, a plus or minus sign can always precede a number.
- The set of characters that can be interpreted as a decimal or grouping separator is smaller.
- If currency parsing is enabled, currencies must only appear where specified in either the current pattern string or in a valid pattern string for the current locale. For example, if the pattern is "ยค0.00", then "$1.23" would match, but "1.23$" would fail to match.
-
JAVA_COMPATIBILITY
public static final DecimalFormatProperties.ParseMode JAVA_COMPATIBILITY
Internal parse mode for increased compatibility with java.text.DecimalFormat. Used by Android libcore. To enable this feature, java.text.DecimalFormat holds an instance of ICU4J's DecimalFormat and enable it by calling setParseStrictMode(ParseMode.JAVA_COMPATIBILITY).
-
-
Method Detail
-
values
public static DecimalFormatProperties.ParseMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DecimalFormatProperties.ParseMode c : DecimalFormatProperties.ParseMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DecimalFormatProperties.ParseMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-