|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagejava.textas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Constant that is returned when the iterator has reached either the end or the beginning of the text. Theunicode 2.0 standard statesvaluethatis '\\uFFFF'isthean"notinvalidaunicodecharacter" valueandwhich should not occur in any validunicodeUnicode string.
AChoiceFormatallows you to attach a format to a range of numbers. It is generally used in aMessageFormatfor handling plurals. The choice is specified with an ascending list of doubles where each item specifies a half-open interval up to the next item:If there is no match then either the first or last index is used depending on whether the number (X) is too low or too high. If the limit array is not in ascending order the results of formatting will be incorrect. ChoiceFormat also acceptsX matches j if and only if limit[j] <= X < limit[j+1]as equivalent to infinity(INF).\\\u221ENote:
ChoiceFormatdiffers from the otherFormatclasses in that you create aChoiceFormatobject with a constructor (not with agetInstancestyle factory method). The factory methods aren't necessary becauseChoiceFormatdoesn't require any complex setup for a given locale. In factChoiceFormatdoesn't implement any locale specific behavior.When creating a
ChoiceFormatyou must specify an array of formats and an array of limits. The length of these arrays must be the same. For example
- limits = {1 2 3 4 5 6 7}
formats = {"Sun" "Mon" "Tue" "Wed" "Thur" "Fri" "Sat"}- limits = {0 1 ChoiceFormat.nextDouble(1)}
formats = {"no files" "one file" "many files"}
(nextDoublecan be used to get the next higher double to make the half-open interval.)Here is a simple example that shows formatting and parsing:
Here is a more complex example with a pattern format:double[] limits = {1 2 3 4 5 6 7}; String[] monthNames = {"Sun" "Mon" "Tue" "Wed" "Thur" "Fri" "Sat"}; ChoiceFormat form = new ChoiceFormat(limits monthNames); ParsePosition status = new ParsePosition(0); for (double i = 0.0; i <= 8.0; ++i) { status.setIndex(0); System.out.println(i + " -> " + form.format(i) + " -> " + form.parse(form.format(i) status)); }double[] filelimits = {0 1 2}; String[] filepart = {"are no files" "is one file" "are {2} files"}; ChoiceFormat fileform = new ChoiceFormat(filelimits filepart); Format[] testFormats = {fileform null NumberFormat.getInstance()}; MessageFormat pattform = new MessageFormat("There {0} on {1}"); pattform.setFormats(testFormats); Object[] testArgs = {null "ADisk" null}; for (int i = 0; i < 4; ++i) { testArgs[0] = new Integer(i); testArgs[2] = testArgs[0]; System.out.println(pattform.format(testArgs)); }Specifying a pattern for ChoiceFormat objects is fairly straightforward. For example:
And the output result would be like the following:ChoiceFormat fmt = new ChoiceFormat( "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more than 2."); System.out.println("Formatter Pattern : " + fmt.toPattern()); System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY)); System.out.println("Format with -1.0 : " + fmt.format(-1.0)); System.out.println("Format with 0 : " + fmt.format(0)); System.out.println("Format with 0.9 : " + fmt.format(0.9)); System.out.println("Format with 1.0 : " + fmt.format(1)); System.out.println("Format with 1.5 : " + fmt.format(1.5)); System.out.println("Format with 2 : " + fmt.format(2)); System.out.println("Format with 2.1 : " + fmt.format(2.1)); System.out.println("Format with NaN : " + fmt.format(Double.NaN)); System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));Format with -INF : is negative Format with -1.0 : is negative Format with 0 : is zero or fraction Format with 0.9 : is zero or fraction Format with 1.0 : is one Format with 1.5 : is 1+ Format with 2 : is two Format with 2.1 : is more than 2. Format with NaN : is negative Format with +INF : is more than 2.
Choice formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently it must be synchronized externally. @see DecimalFormat @see MessageFormat @version 1.22 09/21/98 @author Mark Davis
Class ChoiceFormat, constructor ChoiceFormat(String)
Constructs with limits and corresponding formats based on the pattern. @see #applyPattern
TheCollationElementIteratorclass is used as an iterator to walk through each character of an international string. Use the iterator to return the ordering priority of the positioned character. The ordering priority of a character which we refer to as a key defines how a character is collated in the given collation object.For example consider the following in Spanish:
And in German"ca" -> the first key is key('c') and second key is key('a'). "cha" -> the first key is key('ch') and second key is key('a').The key of a character is an integer composed of primary order(short) secondary order(byte) and tertiary order(byte). Java strictly defines the size and signedness of its primitive data types. Therefore the static functions"äb"-> the first key is key('a') the second key is key('e') and the third key is key('b').primaryOrdersecondaryOrderandtertiaryOrderreturnintshortandshortrespectively to ensure the correctness of the key value.Example of the iterator usage
// get the first key of the stringStringstrtestString = "This is a test";CollationElementIteratorRuleBasedCollatorcruleBasedCollator =new CollationElementIterator(str 0 str.length(RuleBasedCollator)Collator.getInstance(); CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString); int primaryOrder = CollationElementIterator.primaryOrder(c-collationElementIterator.next());
CollationElementIterator.nextreturns the collation order of the next character. A collation order consists of primary order secondary order and tertiary order. The data type of the collation order is int. The first 16 bits of a collation order is its primary order; the next 8 bits is the secondary order and the last 8 bits is the tertiary order. @see Collator @see RuleBasedCollator @version 1.24 07/27/98 @author Helena Shih Laura Werner Richard Gillam
ACollationKeyrepresents aStringunder the rules of a specificCollatorobject. Comparing twoCollationKeys returns the relative order of theStrings they represent. UsingCollationKeys to compareStrings is generally faster than usingCollator.compare. Thus when theStrings must be compared multiple times for example when sorting a list ofStrings. It's more efficient to useCollationKeys.You can not create
CollationKeys directly. Rather generate them by callingCollator.getCollationKey. You can only compareCollationKeys generated from the sameCollatorobject.Generating a
CollationKeyfor aStringinvolves examining the entireStringand converting it to series of bits that can be compared bitwise. This allows fast comparisons once the keys are generated. The cost of generating keys is recouped in faster comparisons whenStrings need to be compared many times. On the other hand the result of a comparison is often determined by the first couple of characters of eachString.Collator.compareexamines only as many characters as it needs which allows it to be faster when doing single comparisons.The following example shows how
CollationKeys might be used to sort a list ofStrings.@see Collator @see RuleBasedCollator @version 1.// Create an array of CollationKeys for the Strings to be sorted. Collator myCollator = Collator.getInstance(); CollationKey[] keys = new CollationKey[3]; keys[0] = myCollator.getCollationKey("Tom"); keys[1] = myCollator.getCollationKey("Dick"); keys[2] = myCollator.getCollationKey("Harry"); sort( keys );
//...
// Inside body of sort routine compare keys this way if( keys[i].compareTo( keys[j] ) > 0 ) // swap keys[i] and keys[j]
//...
// Finally when we've returned from sort. System.out.println( keys[0].getSourceString() ); System.out.println( keys[1].getSourceString() ); System.out.println( keys[2].getSourceString() );14 0115 12/1903/0001 @author Helena Shih
TheClass Collator, int CANONICAL_DECOMPOSITIONCollatorclass performs locale-sensitiveStringcomparison. You use this class to build searching and sorting routines for natural language text.
Collatoris an abstract base class. Subclasses implement specific collation strategies. One subclassRuleBasedCollatoris currently provided with the Java 2 platform and is applicable to a wide set of languages. Other subclasses may be created to handle more specialized needs.Like other locale-sensitive classes you can use the static factory method
getInstanceto obtain the appropriateCollatorobject for a given locale. You will only need to look at the subclasses ofCollatorif you need to understand the details of a particular collation strategy or if you need to modify that strategy.The following example shows how to compare two strings using the
Collatorfor the default locale.// Compare two strings in the default locale Collator myCollator = Collator.getInstance(); if( myCollator.compare("abc" "ABC") <0 ) System.out.println("abc is less than ABC"); else System.out.println("abc is greater than or equal to ABC");You can set a
Collator's strength property to determine the level of difference considered significant in comparisons. Four strengths are provided:PRIMARYSECONDARYTERTIARYandIDENTICAL. The exact assignment of strengths to language features is locale dependant. For example in Czech "e" and "f" are considered primary differences while "e" and "ê" are secondary differences "e" and "E" are tertiary differences and "e" and "e" are identical. The following shows how both case and accents could be ignored for US English.//Get the Collator for US English and set its strength to PRIMARY Collator usCollator = Collator.getInstance(Locale.US); usCollator.setStrength(Collator.PRIMARY); if( usCollator.compare("abc" "ABC") == 0 ) { System.out.println("Strings are equivalent"); }For comparing
Strings exactly once thecomparemethod provides the best performance. When sorting a list ofStrings however it is generally necessary to compare eachStringmultiple times. In this caseCollationKeys provide better performance. TheCollationKeyclass converts aStringto a series of bits that can be compared bitwise against otherCollationKeys. ACollationKeyis created by aCollatorobject for a givenString.
Note:CollationKeys from differentCollators can not be compared. See the class description for CollationKey for an example usingCollationKeys. @see RuleBasedCollator @see CollationKey @see CollationElementIterator @see Locale @version 1.27 0132 12/1903/0001 @author Helena Shih Laura Werner Richard Gillam
Decomposition mode value. With CANONICAL_DECOMPOSITION set characters that are canonical variants according to Unicode 2.0 will be decomposed for collation. ThisClass Collator, int FULL_DECOMPOSITIONis the default setting andshould be used to get correct collation of accented characters.CANONICAL_DECOMPOSITION corresponds to Normalization Form D as described in Unicode Technical Report #15. @see java.text.Collator#getDecomposition @see java.text.Collator#setDecomposition
Decomposition mode value. With FULL_DECOMPOSITION set both Unicode canonical variants and Unicode compatibility variants will be decomposed for collation. This causes not only accented characters to be collated but also characters that have special formats to be collated with their norminal form. For example the half-width and full-width ASCII and Katakana characters are then collated together. FULL_DECOMPOSITION is the most complete and therefore the slowest decomposition mode.Class Collator, int NO_DECOMPOSITIONFULL_DECOMPOSITION corresponds to Normalization Form
DCKD as described in Unicode Technical Report #15. @see java.text.Collator#getDecomposition @see java.text.Collator#setDecomposition
Decomposition mode value. With NO_DECOMPOSITION set accented characters will not be decomposed for collation. This is the default setting and provides the fastest collation but will only produce correct results for languages that do not use accents. @see java.text.Collator#getDecomposition @see java.text.Collator#setDecomposition
DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner. The date/time formatting subclass such as SimpleDateFormat allows for formatting (i.e. date -> text) parsing (text -> date) and normalization. The date is represented as aClass DateFormat, StringBuffer format(Date, StringBuffer, FieldPosition)Dateobject or as the milliseconds since January 1 1970 00:00:00 GMT.DateFormat provides many class methods for obtaining default date/time formatters based on the default or a given
loaclelocale and a number of formatting styles. The formatting styles include FULL LONG MEDIUM and SHORT. More detail and examples of using these styles are provided in the method descriptions.DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale conventions for months days of the week or even the calendar format: lunar vs. solar.
To format a date for the current Locale use one of the static factory methods:
myString = DateFormat.getDateInstance().format(myDate);If you are formatting multiple
numbersdates it is more efficient to get the format and use it multiple times so that the system doesn't have to fetch the information about the local language and country conventions multiple times.DateFormat df = DateFormat.getDateInstance(); for (int i = 0; iTo format a
numberdate for a different Locale specify it in the call to getDateInstance().DateFormat df = DateFormat.getDateInstance(DateFormat.LONG Locale.FRANCE);You can use a DateFormat to parse also.
myDate = df.parse(myString);Use getDateInstance to get the normal date format for that country. There are other static factory methods available. Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale but generally:
- SHORT is completely numeric such as 12.13.52 or 3:30pm
- MEDIUM is longer such as Jan 12 1952
- LONG is longer such as January 12 1952 or 3:30:32pm
- FULL is pretty completely specified such as Tuesday April 12 1952 AD or 3:30:42pm PST.
You can also set the time zone on the format if you wish. If you want even more control over the format or parsing (or want to give your users more control) you can try casting the DateFormat you get from the factory methods to a SimpleDateFormat. This will work for the majority of countries; just remember to put it in a try block in case you encounter an unusual one.
You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to
- progressively parse through pieces of a string.
- align any particular field or find out where it is for selection on the screen.
Synchronization
Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently it must be synchronized externally. @see Format @see NumberFormat @see SimpleDateFormat @see java.util.Calendar @see java.util.GregorianCalendar @see java.util.TimeZone @version 1.
38 0145 12/1903/0001 @author Mark Davis Chen-Lieh Huang Alan Liu
Formats a Date into a date/time string. @param date a Date to be formatted into a date/time string. @param toAppendTo the string buffer for the returning date/time string. @param fieldPosition keeps track of the position of the field within the returned string. On input: an alignment field if desired. On output: the offsets of the alignment field. For example given a time text "1996.07.10 AD at 15:08:56 PDT" if the given fieldPosition is DateFormat.YEAR_FIELD the begin index and end index of fieldPosition will be set to 0 and 4 respectively. Notice that if the same time field appears more than once in a pattern the fieldPosition will be set for the firstClass DateFormat, StringBuffer format(Object, StringBuffer, FieldPosition)occurenceoccurrence of that time field. For instance formatting a Date to the time string "1 PM PDT (Pacific Daylight Time)" using the pattern "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD the begin index and end index of fieldPosition will be set to 5 and 8 respectively for the firstoccurenceoccurrence of the timezone pattern character 'z'. @return the formatted date/time string.
Overrides Format. Formats a time object into a time string. Examples of time objects are a time value expressed in milliseconds and a Date object. @param obj must be a Number or a Date. @param toAppendTo the string buffer for the returning time string. @return the formatted time string. @param fieldPosition keeps track of the position of the field within the returned string. On input: an alignment field if desired. On output: the offsets of the alignment field. For example given a time text "1996.07.10 AD at 15:08:56 PDT" if the given fieldPosition is DateFormat.YEAR_FIELD the begin index and end index of fieldPosition will be set to 0 and 4 respectively. Notice that if the same time field appears more than once in a pattern the fieldPosition will be set for the firstClass DateFormat, Date parse(String)occurenceoccurrence of that time field. For instance formatting a Date to the time string "1 PM PDT (Pacific Daylight Time)" using the pattern "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD the begin index and end index of fieldPosition will be set to 5 and 8 respectively for the firstoccurenceoccurrence of the timezone pattern character 'z'. @see java.text.Format
Class DateFormat, Date parse(String, ParsePosition)ParseParses text from the beginning of the given string to produce a date/time. The method may not use the entire text of the given string.See the ParsePosition) method for more information on date parsing. @param
text Thesource Adate/timeStringstringwhosetobeginning should be parsed. @return ADateor nullparsediffrom theinput could not be parsedstring. @exception ParseExceptionIfif thegivenbeginning of the specified string cannot be parsedas a date.@see #parse(String ParsePosition)
Parse a date/time string according to the given parse position. For example a time text "07/10/96 4:5 PM PDT" will be parsed into a Date that is equivalent to Date(837039928046).Class DateFormat, Object parseObject(String, ParsePosition)By default parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false). @see java.text.DateFormat#setLenient(boolean) @param
textsource The date/time string to be parsed @param pos On input the position at which to start parsing; on output the position at which parsing terminated or the start position if the parse failed. @return A Date or null if the input could not be parsed
Parse aParses textdate/timefrom a stringintotoanproduce aObjectDate.This convenienceThe method
simplyattemptscallsto parse text starting at the index given bypos. If parsing succeeds then the index ofposis updated to the index after the last character used (Stringparsing does not necessarily use all characters up to the end of the string) and the parsed date is returned. The updatedposcan be used to indicate the starting point for the next call to this method. If an error occurs then the index ofposis not changed the error index ofposis set to the index of the character where the error occurred and null is returned. ParsePosition) method for more information on date parsing. @seeparam#parse(source AString part of which should be parsed. @param pos AParsePosition)object with index and error index information as described above. @return ADateparsed from the string. In case of error returns null. @exception NullPointerException ifposis null.
Class DateFormatSymbols, String[] getAmPmStrings()DateFormatSymbolsis a public class for encapsulating localizable date-time formatting data such as the names of the months the names of the days of the week and the time zone data.DateFormatandSimpleDateFormatboth useDateFormatSymbolsto encapsulate this information.Typically you shouldn't use
DateFormatSymbolsdirectly. Rather you are encouraged to create a date-time formatter with theDateFormatclass's factory methods:getTimeInstancegetDateInstanceorgetDateTimeInstance. These methods automatically create aDateFormatSymbolsfor the formatter so that you don't have to. After the formatter is created you may modify its format pattern using thesetPatternmethod. For more information about creating formatters usingDateFormat's factory methods see DateFormatIf you decide to create a date-time formatter with a specific format pattern for a specific locale you can do so with:
new SimpleDateFormat(aPattern new DateFormatSymbols(aLocale)).
DateFormatSymbolsobjects areclonablecloneable. When you obtain aDateFormatSymbolsobject feel free to modify the date-time formatting data. For instance you can replace the localized date-time format pattern characters with the ones that you feel easy to remember. Or you can change the representative cities to your favorite ones.New
DateFormatSymbolssubclasses may be added to supportSimpleDateFormatfor date-time formatting for additional locales. @see DateFormat @see SimpleDateFormat @see java.util.SimpleTimeZone @version 1.32390112/1903/0001 @author Chen-Lieh Huang
Gets ampm strings. For example: "AM" and "PM". @return theweekdayampm strings.
Class DecimalFormat, constructor DecimalFormat()DecimalFormatis a concrete subclass ofNumberFormatthat formats decimal numbers. It has a variety of features designed to make it possible to parse and format numbers in any locale including support for Western Arabic and Indic digits. It also supports different kinds of numbers including integers (123) fixed-point numbers (123.4) scientific notation (1.23E4) percentages (12%) and currency amounts ($123). All of these can be localized.To obtain a
NumberFormatfor a specific locale including the default locale call one ofNumberFormat's factory methods such asgetInstance(). In general do not call theDecimalFormatconstructors directly since theNumberFormatfactory methods may return subclasses other thanDecimalFormat. If you need to customize the format object do something like this:NumberFormat f = NumberFormat.getInstance(loc); if (f instanceof DecimalFormat) { ((DecimalFormat) f).setDecimalSeparatorAlwaysShown(true); }A
DecimalFormatcomprises a pattern and a set of symbols. The pattern may be set directly usingapplyPattern()or indirectly using the API methods. The symbols are stored in aDecimalFormatSymbolsobject. When using theNumberFormatfactory methods the pattern and symbols are read from localizedResourceBundlesin the.packagePatterns
java.text.resourceDecimalFormat. Example// Print out a numberpatternsusinghave thelocalized number currency // and percent format for each locale Locale[] locales = NumberFormat.getAvailableLocales(); double myNumber = -1234.56; NumberFormat form; forfollowing(intsyntax:j=0;j;Pattern:++j)PositivePattern{PositivePatternSystem.out.println("FORMAT");forNegativePattern(intPositivePattern:iPrefixopt=Number0;SuffixoptiNegativePattern:locales.length;Prefixopt++i)Number{SuffixoptifPrefix:(locales[i].getCountry().length()any==Unicode0)characters{exceptcontinue\;// Skip language-onlyuFFFElocales } System.out.print(locales[i].getDisplayName())\;switchuFFFF(j)and{ casespecial characters0Suffix:form= NumberFormat.getInstance(locales[i]); break; case 1:anyform =Unicode charactersNumberFormat.getCurrencyInstance(locales[i]);exceptbreak\;default: form =uFFFENumberFormat.getPercentInstance(locales[i])\;uFFFFbreak;and} tryspecial characters{Number://IntegerAssumeExponentoptformIntegeris.aFractionDecimalFormatExponentoptSystem.out.print("Integer:" +((DecimalFormat)MinimumIntegerform).toPattern()#+#"Integer-#"Integer+MinimumInteger:form.format(myNumber));0}0catchMinimumInteger(IllegalArgumentException0e)MinimumInteger{}Fraction:tryMinimumFractionopt{OptionalFractionoptSystem.out.println("MinimumFraction:-0"MinimumFractionopt+OptionalFraction:form.parse(form.format(myNumber)));#}OptionalFractionoptcatchExponent:(ParseExceptionEe)MinimumExponent{}MinimumExponent:}0}MinimumExponentopt
PatternsADecimalFormatpattern contains apostivepositive and negative subpattern for example"# ##0.00;(# ##0.00)". Each subpattern has a prefix numeric part and suffix. The negative subpattern is optional; if absent then the positive subpattern prefixed with the localized minus sign (code>'-' in most locales) is used as the negative subpattern. That is"0.00"alone is equivalent to"0.00;-0.00". If there is an explicit negative subpattern it serves only to specify the negative prefix and suffix; the number of digits minimal digits and other characteristics are all the same as the positive pattern. That means that"# ##0.0#;(#)"produces precisely the same behavior as"# ##0.0#;(# ##0.0#)".The prefixes suffixes and various symbols used for infinity digits thousands separators decimal separators etc. may be set to arbitrary values and they will appear properly during formatting. However care must be taken that the symbols and strings do not conflict or parsing will be unreliable. For example either the positive and negative prefixes or the suffixes must be distinct for
DecimalFormat.parse()to be able to distinguish positive from negative values. (If they are identical thenDecimalFormatwill behave as if no negative subpattern was specified.) Another example is that the decimal separator and thousands separator should be distinct characters or parsing will be impossible.The grouping separator is commonly used for thousands but in some countries it separates ten-thousands. The grouping size is a constant number of digits between the grouping characters such as 3 for 100 000 000 or 4 for 1 0000 0000. If you supply a pattern with multiple grouping characters the interval between the last one and the end of the integer is the one that is used. So
"# ## ### ####"=="###### ####"=="## #### ####".Illegal patternsSpecial
suchPatternasCharacters"#.#.#"Many
orcharacters"#.###in###"awill causepattern areDecimalFormattakentoliterally;throw anthey areIllegalArgumentExceptionmatchedwith a message that describes the problemduring parsing and output unchanged during formatting.Parsing DecimalFormat parses all UnicodeSpecial charactersthat representondecimal digits as defined bythe other hand stand forCharacter.digit().otherIn additioncharacters stringsDecimalFormatoralso recognizesclasses ofascharacters.digits the ten consecutive characters starting with the localized zero digit definedThey must be quoted unless noted otherwise if they are to appear in theDecimalFormatSymbols object. During formatting theprefixDecimalFormatSymbols-basedordigits are outputsuffix as literals.
DecimalFormat.parse returns aThesubclass ofcharacters listedjava.lang.Numberhererepresenting the parsedare used innumericnon-localizedstringpatterns.DecimalFormat chooses the most economical subclass thatLocalizedcan representpatterns use thenumeric string. This means mostcorrespondinginteger values are returnedcharacters taken from thisasformatter'sLongDecimalFormatSymbolsobjects noobjectmatter how they areinstead and these characterswritten:lose"17"theirandspecial"17status.000"both parse toTwoLong(17).exceptionsValues that cannot fit into aare the currency sign and quoteLongwhich arereturned asnotDoubleslocalized.This includesScientific Notationvalues with
aSymbol fractionalLocation partLocalized infiniteMeaning valuesNaN0andNumber theYes valueDigit -0.0.DecimalFormat#does not decideNumber whetherYes toDigit return azero showsDoubleasor aabsentLong.basedNumber onYes theDecimal presence of aseparator or monetary decimal separatorin the sourcestring. Doing so-wouldNumber preventYes integersMinus that overflowsignthemantissaofNumber aYes doubleGrouping such asseparator"10E000Number 000Yes 000Separates 000mantissa000.00"andfrom being parsed accuratelyexponent in scientific notation.Currently theNeedonly classes thatnot be quotedDecimalFormatinreturns areprefix orLongsuffix.andDouble;but callers should not rely onSubpattern this.boundaryCallersYes maySeparates use thepositive andNumbernegativemethodssubpatternsdoubleValuelongValue%etc. to obtain the type theyPrefix want.orIfsuffixDecimalFormat.parse(StringYes ParsePosition)Multiply fails to parse a string it returnsby 100 and show as percentagenull\u2030leaves thePrefix ParsePositionorindexsuffixunchangedYes andMultiply sets theby 1000ParsePositionanderrorshowindex.asThe convenience methodper milleDecimalFormat.parse(String)¤indicates parse failure by throwing a(ParseException\u00A4. Special)ValuesPrefix NaNorissuffixformattedNo asCurrency a single character typicallysign replaced by currency\uFFFDsymbol.This characterIfis determineddoubled replaced bytheinternationalDecimalFormatSymbolscurrencyobjectsymbol.This is theIfonly value for whichpresent in a pattern theprefixes andmonetarysuffixes are notdecimal separator is used. Infinityis formattedinsteadas a singleof the decimalcharacterseparator.typically\u221E'with the positivePrefix or negative prefixes andsuffixsuffixesNo applied.Used The infinity character is determined by theto quote special characters in a prefixDecimalFormatSymbolsorobject.suffixNegativeforzero (example"-0'#'#")parsesformats 123 to.Double(-0.0)"#123"unlessToisParseIntegerOnly()createis true in which case it parsesa single quote itself use two intoa row:.Long(0)"# o''clock"Numbers in scientific notation are expressed as the product of a mantissa and a power of ten for example 1234 can be expressed as 1.234 x 10^3. The mantissa is often in the range 1.0 < x <10.0 but it need not be.
DecimalFormatcan be instructed to format and parse scientific notation only via a pattern; there is currently no factory method that creates a scientific notation format. In a pattern the exponent character immediately followed by one or more digit characters indicates scientific notation. Example:"0.###E0"formats the number 1234 as"1.234E3".
- The number of digit characters after the exponent character gives the minimum exponent digit count. There is no maximum. Negative exponents are formatted using the localized minus sign not the prefix and suffix from the pattern. This allows patterns such as
"0.###E0 m/s".- The minimum and maximum number of integer digits are interpreted together:
- If the maximum number of integer digits is greater than their minimum number and greater than 1 it forces the exponent to be a multiple of the maximum number of integer digits and the minimum number of integer digits to be interpreted as 1. The most common use of this is to generate engineering notation in which the exponent is a multiple of three e.g.
"##0.#####E0". Using this pattern the number 12345 formats to"12.345E3"and 123456 formats to"123.456E3".- Otherwise the minimum number of integer digits is achieved by adjusting the exponent. Example: 0.00123 formatted with
"00.###E0"yields"12.3E-4".- The number of significant digits in the mantissa is the sum of the minimum integer and maximum fraction digits and is unaffected by the maximum integer digits. For example 12345 formatted with
"##0.##E0"is"12.3E3". To show all digits set the significant digits count to zero. The number of significant digits does not affect parsing.- Exponential patterns may not contain grouping separators.
PatternRounding
SyntaxDecimalFormatusespatternhalf-even:=roundingpos_pattern{';'(seenegROUND_pattern} posHALF_pattern :=EVEN{prefix}number{suffix}forneg_patternformatting.:=Digits
{prefix}number{suffix}Fornumberformatting:=DecimalFormatinteger{'.'usesfraction}{exponent}theprefixten:=consecutive'\u0000'..'\uFFFD'characters-startingspecial_characterswithsuffixthe:=localized'\u0000'..'\uFFFD'zero-digitspecial_charactersdefinedintegerin:=themin_intDecimalFormatSymbols|object'#'as|digits.'#'Forinteger |parsing these'#'digits' ' integeras well asmin_intall:=Unicode'0'decimal|digits'0'asmin_intdefined|by'0'Character.digit'are'recognized.min_intSpecial
fractionValues:=
NaN'0'*is'#'*formattedexponentas:=a'E'single'0'character'0'*typically.3292;Notation: X* 0 or more instances of X { X } 0 or 1 instances of X X | Y either X or Y X.uFFFDYanyThis characterfromisX up todetermined by theYDecimalFormatSymbolsinclusiveobject.S - T characters in S except those in TThis is the only value for which the prefixes and suffixesSpecialarePatternnotCharactersused.
Many charactersInfinity isinformatted as apattern are takensingle character typicallyliterally\;theyu221Eare matched during parsing and output unchanged during formattingwith the positive or negative prefixes and suffixes applied.SpecialThecharacters on the other hand standinfinity character is determined by theforDecimalFormatSymbolsotherobject.charactersNegative
stringszeroor("-0")classes ofparses tocharactersDouble(-0.unlessThey must be quoted0)noted otherwise if they areisParseIntegerOnly()to appearis true inthewhichprefix or suffix ascase it parses toliteralsLong(0).TheSynchronization
characters listed hereDecimal formats are
used ingenerallynon-localizednotpatternssynchronized.Localized patterns use the corresponding characters taken from this formatter'sItDecimalFormatSymbolsisobject instead and these characters lose their special statusrecommended to create separate format instances for each thread.TwoIfexceptions are the currency sign and quote which are not localizedmultiple threads access a format concurrently it must be synchronized externally.Example
SymbolLocationLocalized@seeMeaning//0NumberYDigitPrint#NumberYDigitoutzero shows asa number usingabsentthe.NumberYDecimallocalizedseparator or monetarynumber integer currencydecimal//separatorand-NumberYMinuspercentsignformat forNumberYGroupingeachseparatorlocaleENumberYLocale[]Separateslocalesmantissa=andNumberFormat.getAvailableLocales();exponent in scientificdouble myNumber =notation-1234.56;NeedNumberFormatnotform;beforquoted(intinj=0;prefixj<;or++j)suffix.{ System.out.println("FORMAT");Subpattern boundaryYSeparatesforpositive(intand negativei =subpatterns0;%Prefixior<locales.length;suffixYMultiply++i)by 100{ ifand(locales[i].getCountry().length()show==as0)percentage{\continue;u2030Prefix or suffixY Multiply by 1000and//showSkipaslanguage-onlyperlocalesmille}¤System.out.print(\u00A4locales[i].getDisplayName()Prefix);orswitchsuffixN(j)Currency{signcasereplaced0:by currency symbolform = NumberFormat.IfgetInstance(locales[i]);doubledbreak;replacedcaseby1:international currency symbolform = NumberFormat.If present in a patterngetIntegerInstance(locales[i]);thebreak;monetarycasedecimal2:separator isform =usedNumberFormat.getCurrencyInstance(locales[i]);insteadbreak;ofdefault:the decimal separatorform = NumberFormat.'Prefix orgetPercentInstance(locales[i]);suffixNbreak;Used}toifquote(formspecialinstanceofcharactersDecimalFormat)in{aSystem.out.print(":prefix or" +suffix((DecimalFormat)forform).toPattern());example}"'#'#System.out.print("formats->123 to" +"#123"form.format(myNumber));To createtry {aSystem.out.println("single->quote itself" +useform.parse(form.format(myNumber)));two in} catcha(ParseExceptionrow:e)"#{}o''clock".} }java.text.FormatJava Tutorial @seejava.text.NumberFormat @seejava.text.ChoiceFormatDecimalFormatSymbols @seejava.text.ParsePosition @version 1.59 0268 12/0903/01 @author Mark Davis @author Alan Liu
Class DecimalFormat, constructor DecimalFormat(String)CreateCreates a DecimalFormat using the default pattern and symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.To obtain standard formats for a given locale use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale. @see java.text.NumberFormat#getInstance @see java.text.NumberFormat#getNumberInstance @see java.text.NumberFormat#getCurrencyInstance @see java.text.NumberFormat#getPercentInstance
Class DecimalFormat, constructor DecimalFormat(String, DecimalFormatSymbols)CreateCreates a DecimalFormatfromusing the given pattern and the symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.To obtain standard formats for a given locale use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale. @param pattern A non-localized pattern string. @exception NullPointerException if
patternis null @exception IllegalArgumentException if the given pattern is invalid. @see java.text.NumberFormat#getInstance @see java.text.NumberFormat#getNumberInstance @see java.text.NumberFormat#getCurrencyInstance @see java.text.NumberFormat#getPercentInstance
Class DecimalFormat, void applyLocalizedPattern(String)CreateCreates a DecimalFormatfromusing the given pattern and symbols. Use this constructor when you need to completely customize the behavior of the format.To obtain standard formats for a given locale use the factory methods on NumberFormat such as getInstance or getCurrencyInstance. If you need only minor adjustments to a standard format you can modify the format returned by a NumberFormat factory method. @param pattern a non-localized pattern string @param symbols the set of symbols to be used @exception NullPointerException if any of the given arguments is null @exception IllegalArgumentException if the given pattern is invalid @see java.text.NumberFormat#getInstance @see java.text.NumberFormat#getNumberInstance @see java.text.NumberFormat#getCurrencyInstance @see java.text.NumberFormat#getPercentInstance @see java.text.DecimalFormatSymbols
Apply the given pattern to this Format object. The pattern is assumed to be in a localized notation. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.Class DecimalFormat, void applyPattern(String)There is no limit to integer digits are set by this routine since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers use a second pattern separated by a semicolon
Example
"# #00.0#"-> 1 234.56This means a minimum of 2 integer digits 1 fraction digit and a maximum of 2 fraction digits.
Example:
"# #00.0#;(# #00.0#)"for negatives inparanthesesparentheses.In negative patterns the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern. @exception NullPointerException if
patternis null @exception IllegalArgumentException if the given pattern is invalid.
Apply the given pattern to this Format object. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.Class DecimalFormat, StringBuffer format(double, StringBuffer, FieldPosition)There is no limit to integer digits are set by this routine since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers use a second pattern separated by a semicolon
Example
"# #00.0#"-> 1 234.56This means a minimum of 2 integer digits 1 fraction digit and a maximum of 2 fraction digits.
Example:
"# #00.0#;(# #00.0#)"for negatives inparanthesesparentheses.In negative patterns the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern. @exception NullPointerException if
patternis null @exception IllegalArgumentException if the given pattern is invalid.
Formats a double to produce a string. @param number The double to format @paramClass DecimalFormat, StringBuffer format(long, StringBuffer, FieldPosition)toAppendToresult where the text is to be appended @param fieldPosition On input: an alignment field if desired. On output: the offsets of the alignment field. @return Thevalue passed in as theformattedresult parameternumber string @see java.text.FieldPosition
Format a long to produce a string. @param number The long to format @paramClass DecimalFormat, Number parse(String, ParsePosition)toAppendToresult where the text is to be appended @param fieldPosition On input: an alignment field if desired. On output: the offsets of the alignment field. @return Thevalue passed in as theformattedresult parameternumber string @see java.text.FieldPosition
Returns an instanceParses text fromofa string to produce aNumber.with a value matchingThe method attempts to parse text starting at the index given by
pos. If parsing succeeds then the index ofposis updated to the index after the last character used (parsing does not necessarily use all characters up to the end of the string) and the parsed number is returned. The updatedposcan be used to indicate the starting point for the next call to this method. If an error occurs then the index ofposis not changed the error index ofposis set to the index of the character where the error occurred and null is returned.The most economical subclass that can represent
allthebits of the sourcenumber given by the string is chosen.@paramMosttext theinteger valuesstringare returned asLongobjects no matter how they are written:"17"and"17.000"both parse tobeLong(17).parsedValues@paramthatparsePosition on entrycannot fit intowhereaLongare returned asDoubles. This includes values with a fractional part infinite valuesNaNand the value -0.0.DecimalFormatdoes not decide whether tobeginreturn aparsing;Doubleor aLongbased onexitthe presencejustof a decimalpastseparator in thelastsourceparsedstring.characterDoing so would prevent integers that overflow the mantissa of a double such as"10 000 000 000 000 000.00"If parsingfrom beingfailsparsed accurately. Currently theindex will notonly classes thatmoveparsereturns areLongandDoublebut callers should not rely on this. Callers may use theNumbermethodsdoubleValuelongValueetc. to obtain the type they want.
DecimalFormatparses all Unicode characters that represent decimal digits as defined byCharacter.digit(). In additionDecimalFormatalso recognizes as digits the ten consecutive characters starting with the localized zero digit defined in theDecimalFormatSymbolsobject. @param text the string to be parsed @param pos AParsePositionobject with index and error indexwill beinformation assetdescribed above. @return the parsed value ornullif the parse fails @exception NullPointerException iftextorposis null.
This class represents the set of symbols (such as the decimal separator the grouping separator and so on) needed byClass DecimalFormatSymbols, constructor DecimalFormatSymbols(Locale)DecimalFormatto format numbers.DecimalFormatcreates for itself an instance ofDecimalFormatSymbolsfrom its locale data. If you need to change any of these symbols you can get theDecimalFormatSymbolsobject from yourDecimalFormatand modify it. @see java.util.Locale @see DecimalFormat @version 1.30 0135 12/1903/0001 @author Mark Davis @author Alan Liu
Create a DecimalFormatSymbols object for the given locale. @exception NullPointerException if locale is null
Class DecimalFormatSymbols, String getCurrencySymbol()Class DecimalFormatSymbols, String getInfinity()ReturnReturns thestringcurrencydenoting the localsymbol for the currency of these DecimalFormatSymbols in their locale.
Gets theClass DecimalFormatSymbols, String getInternationalCurrencySymbol()characterstring used to represent infinity. Almost always left unchanged.
Class DecimalFormatSymbols, char getMonetaryDecimalSeparator()ReturnReturns theinternationalISOstring denoting the4217 currency codelocalof the currency of these DecimalFormatSymbols.
Class DecimalFormatSymbols, String getNaN()ReturnReturns the monetary decimal separator.
Gets theClass DecimalFormatSymbols, void setCurrencySymbol(String)characterstring used to representNaN"not a number". Almost always left unchanged.
Class DecimalFormatSymbols, void setDecimalSeparator(char)SetSets thestringcurrencydenoting the localsymbol for the currency of these DecimalFormatSymbols in their locale.
Class DecimalFormatSymbols, void setDigit(char)SetSets the character used for decimal sign. Different for French etc.
Class DecimalFormatSymbols, void setGroupingSeparator(char)SetSets the character used for a digit in a pattern.
Class DecimalFormatSymbols, void setInfinity(String)SetSets the character used for thousands separator. Different for French etc.
Class DecimalFormatSymbols, void setInternationalCurrencySymbol(String)SetSets thecharacterstring used to represent infinity. Almost always left unchanged.
Class DecimalFormatSymbols, void setMinusSign(char)SetSets theinternationalISOstring4217denotingcurrency code of the currency of these DecimalFormatSymbols. If the currency code is valid (as defined by Currency.getInstance this also sets the currency attribute to the corresponding Currency instance and the currency symbol attribute to the currency's symbol in the DecimalFormatSymbols' locale. If the currency code is not valid then thelocalcurrency attribute is set to null and the currency symbol attribute is not modified. @see #setCurrency @see #setCurrencySymbol
Class DecimalFormatSymbols, void setMonetaryDecimalSeparator(char)SetSets the character used to represent minus sign. If no explicit negative format is specified one is formed by prefixing minusSign to the positive format.
Class DecimalFormatSymbols, void setNaN(String)SetSets the monetary decimal separator.
Class DecimalFormatSymbols, void setPatternSeparator(char)SetSets thecharacterstring used to representNaN"not a number". Almost always left unchanged.
Class DecimalFormatSymbols, void setPerMill(char)SetSets the character used to separate positive and negative subpatterns in a pattern.
Class DecimalFormatSymbols, void setPercent(char)SetSets the character used for mille percent sign. Different for Arabic etc.
Class DecimalFormatSymbols, void setZeroDigit(char)SetSets the character used for percent sign. Different for Arabic etc.
SetSets the character used for zero. Different for Arabic etc.
FieldPositionis a simple class used byFormatand its subclasses to identify fields in formatted output. Fieldsarecan be identifiedbyinconstantstwo ways:
By an integer constant whose names typically end with _FIELD. The constants are defined in the various subclasses ofFormat.SeeBy a Format.Fieldconstant seeERA_FIELDand its friends inDateFormatfor an example.
FieldPositionkeeps track of the position of the field within the formatted output with two indices: the index of the first character of the field and the index of the last character of the field.One version of the
formatmethod in the variousFormatclasses requires aFieldPositionobject as an argument. You use thisformatmethod to perform partial formatting or to get information about the formatted output (such as the position of a field).If you are interested in the positions of all attributes in the formatted string use the
FormatmethodformatToCharacterIterator. @version 1.16 0118 12/1903/0001 @author Mark Davis @see java.text.Format
Class Format, Object clone()Formatis an abstract base class for formatting locale-sensitive information such as dates messages and numbers.
Formatdefines the programming interface for formatting locale-sensitive objects intoStrings (theformatmethod) and for parsingStrings back into objects (theparseObjectmethod).Any
StringGenerallyformattedabyformat'sformatparseObjectis guaranteedmethodtomust beparseable by parseObject.ableIf formatting is unsuccessful because theto parse any string formatted by itsFormat object cannotformatthe type ofobjectmethod.specifiedHoweverformattherethrows anmay beIllegalArgumentException.exceptionalOtherwise if therecases where this issomethingnotillformedpossible.about the objectFor example aformatreturns the Unicodemethodreplacement charactermight create\\uFFFD.twoIf there isadjacent integer numbers with nomatchseparatorwhen parsingin betweenparseObject(String)andthrows ain thisParseExceptioncaseandtheparseObject(String ParsePosition)leaves thecould notParsePositiontellindexwhichmember unchanged and returnsdigits belong to whichnullnumber.Subclassing
The Java 2 platform provides three:concretespecialized subclasses ofFormat--DateFormatMessageFormatandNumberFormat--for formatting dates messages and numbers respectively.Concrete subclasses must implement
these twothree methods:These general methods allow polymorphic parsing and formatting of objects and are used for example by
format(Object obj StringBuffer toAppendTo FieldPosition pos)parseObjectformatToCharacterIterator(Object obj)parseObject(String source ParsePosition pos)MessageFormat. Subclasses often also provide additionalformatmethods for specific input types as well asparsemethods for specific result types. Anyparsemethod that does not take aParsePositionargument should throwParseExceptionwhen no text in the required format is at the beginning of the input text.Most subclasses will also implement the following
twofactory methods:In addition some subclasses may also
getInstancefor getting a useful format object appropriate for the current localegetInstance(Locale)for getting a useful format object appropriate for the specified localechoose toimplement othergetXxxxInstancemethods for more specialized control. For example theNumberFormatclass providesgetPercentInstanceandgetCurrencyInstancemethods for getting specialized number formatters.Subclasses of
Formatthat allow programmers to create objects for locales (withgetInstance(Locale)for example) must also implement the following class method:public static Locale[] getAvailableLocales()And finally subclasses may define a set of constants to identify the various fields in the formatted output. These constants are used to create a FieldPosition object which identifies what information is contained in the field and its position in the formatted result. These constants should be named
item_FIELDwhereitemidentifies the field. For examples of these constants seeERA_FIELDand its friends in DateFormatSynchronization
Formats are generally not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently it must be synchronized externally. @see java.text.ParsePosition @see java.text.FieldPosition @see java.text.NumberFormat @see java.text.DateFormat @see java.text.MessageFormat @version 1.
28 0131 12/1903/0001 @author Mark Davis
Class Format, String format(Object)OverridesCreatesCloneableand returns a copy of this object. @return a clone of this instance.
Formats an object to produce a string.@param obj The object to format @return Formatted string. @exception IllegalArgumentExceptionSubclassesThiswill override the StringBufferis equivalent toversionStringBuffeofFieldPosition) format}(obj new StringBuffer() new FieldPosition(0)).toString();
Formats an objectClass Format, Object parseObject(String)to produceandaappendsstring.theSubclasses will implement for particular objectresulting text to a given stringsuchbuffer.as:If theStringBufferposformatargument(Numberidentifiesobj StringBuffera fieldtoAppendTo)usedNumber parseby the(Stringformatstr)thenThese general routines allow polymorphic parsingits indices are set to the beginning andformattingendfor objects such as the MessageFormatof the first such field encountered. @param obj The object to format @param toAppendTo where the text is to be appended @param posOnAinput:FieldPositionan alignmentidentifying a fieldif desired. On output: the offsets ofin thealignmentformattedfield.text @return thevaluestring buffer passed in astoAppendTo(thiswithallows chaining asformatted text appendedwith@exceptionStringBuffer.append())NullPointerException iftoAppendToorposis null @exception IllegalArgumentExceptionwhenif the Format cannot format the given object. @see MessageFormat @see java.text.FieldPosition
ParsesClass Format, Object parseObject(String, ParsePosition)atext from the beginning of the given string to produce an object. The method may not use the entire text of the given string. @param source AStringwhose beginning should be parsed. @return AnObjectparsed from the string. @exception ParseException if the beginning of the specified stringiscannot beinvalidparsed.
Parses text from a string to produce an object.Subclasses will typically implement for particular object such as:
String formatThe method attempts(Numbertoobj);parseString formattext starting(longatobj);theString formatindex given(doublebyobj);pos.Number parseIf parsing(Stringsucceedsstr);then the@paramindexstatusofInput-Outputposparameter.isBeforeupdatedcalling setto thestatus.indextoafter theoffset you wantlastto startcharacter used (parsingat in thedoes not necessarilysource.useAfter callingall charactersstatus.indexupisto the end of thetext you parsed.string)If error occurs indexand the parsed object isunchangedreturned.When parsing leading whitespace is discarded (with successful parse) while trailing whitespace is leftTheasupdatedis.posExample:canParsingbe"_12_xy"used(whereto_ represents aindicate the startingspace)point fora number with index == 0 will result inthenumber 12 with status.indexnextupdatedcall to3 (just before the secondthisspace)method.Parsing a secondIftime will result in a ParseException sincean error occurs then the index of"xy"posis nota numberchangedand leavethe error indexat 3. Subclasses will typically supply specificofparseposmethods that return different typesis set to the index ofvalues. Since methodsthecan'tcharacteroverload on return types these will typicallywhere the error occurred and null isbereturned.named@param"parse"sourcewhileAthisStringpolymorphic method will alwayspart of which should becalled parseObjectparsed.Any parse method that does not take a status should throw@paramParseException whenpos AnoParsePositiontext in the required format is at the start positionobject with index and error index information as described above. @return AnObject parsed from the string. In case of error returns null. @seeexceptionjava.textNullPointerException ifposis null.ParsePosition
MessageFormatprovides a means to produce concatenated messages in language-neutral way. Use this to construct messages displayed for end users.
MessageFormattakes a set of objects formats them then inserts the formatted strings into the pattern at the appropriate places.Note:
MessageFormatdiffers from the otherFormatclasses in that you create aMessageFormatobject with one of its constructors (not with agetInstancestyle factory method). The factory methods aren't necessary becauseMessageFormatitself doesn'trequire any compleximplementsetup forlocale specificabehavior.givenAny locale. InfactspecificMessageFormatbehaviordoesn'tisimplement any locale specific behavior atdefined by the pattern that youall.provideIt just needs to be set up onas well as the subformats used for insertedaarguments.sentencePatterns
by sentenceand Theirbasis.InterpretationMessageFormatHere are some examples of usageuses patterns of the following form:Object[]MessageFormatPattern:argumentsString=MessageFormatPattern FormatElement String FormatElement: {newArgumentIndexInteger(7)}new{Date(System.currentTimeMillis())