License:
Version:
Author:
Interface | Description |
---|---|
IFormatService | Retrieves an object to control formatting. |
Class | Description |
---|---|
Calendar | Represents time in week, month and year divisions. |
Culture | Provides information about a culture, such as its name, calendar and date and number format patterns. |
DateTimeFormat | Determines how Time values are formatted, depending on the culture. |
DaylightSavingTime | Represents a period of daylight-saving time. |
Gregorian | Represents the Gregorian calendar. |
Hebrew | Represents the Hebrew calendar. |
Hijri | Represents the Hijri calendar. |
Japanese | Represents the Japanese calendar. |
Korean | Represents the Korean calendar. |
NumberFormat | Determines how numbers are formatted, according to the current culture. |
Region | Provides information about a region. |
Taiwan | Represents the Taiwan calendar. |
ThaiBuddhist | Represents the Thai Buddhist calendar. |
Struct | Description |
---|---|
Time | Represents time expressed as a date and time of day. |
TimeSpan | Represents a time interval. |
Remarks:
Remarks:
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import tango.io.Stdout, tango.text.locale.Core; void main() { Culture culture = new Culture("it-IT"); Stdout.formatln("englishName: {}", culture.englishName); Stdout.formatln("nativeName: {}", culture.nativeName); Stdout.formatln("name: {}", culture.name); Stdout.formatln("parent: {}", culture.parent.name); Stdout.formatln("isNeutral: {}", culture.isNeutral); } // Produces the following output: // englishName: Italian (Italy) // nativeName: italiano (Italia) // name: it-IT // parent: it // isNeutral: false |
Parameters:
cultureName | The name of the Culture. |
Parameters:
cultureID | The identifer (LCID) of the Culture. |
Remarks:
Parameters:
type | The TypeInfo of the resulting formatting object. |
Returns:
Remarks:
Parameters:
cultureID | The identifier of the culture. |
Returns:
Remarks:
Parameters:
cultureName | The name of the culture. |
Returns:
Remarks:
Parameters:
name | The name of the language. |
Returns:
Parameters:
types | A combination of CultureTypes. |
Returns:
Returns:
Returns:
Parameters:
value | The Culture instance representing the user's _current culture. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import tango.io.Print, tango.text.locale.Common; void main() { // Displays the name of the current culture. Println("The current culture is %s.", Culture.current.englishName); // Changes the current culture to el-GR. Culture.current = new Culture("el-GR"); Println("The current culture is now %s.", Culture.current.englishName); } // Produces the following output: // The current culture is English (United Kingdom). // The current culture is now Greek (Greece). |
Returns:
Remarks:
Returns:
Remarks:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import tango.io.Print, tango.text.locale.Common; void main() { foreach (c; Culture.getCultures(CultureTypes.All)) { if (c.twoLetterLanguageName == "zh") { Print(c.englishName); if (c.isNeutral) Println("neutral"); else Println("specific"); } } } // Produces the following output: // Chinese (Simplified) - neutral // Chinese (Taiwan) - specific // Chinese (People's Republic of China) - specific // Chinese (Hong Kong S.A.R.) - specific // Chinese (Singapore) - specific // Chinese (Macao S.A.R.) - specific // Chinese (Traditional) - neutral |
Returns:
Remarks:
Returns:
Returns:
Returns:
Parameters:
values | A NumberFormat defining the culturally appropriate format for displaying numbers and currency. |
Returns:
Parameters:
values | A DateTimeFormat defining the culturally appropriate format for displaying dates and times. |
Remarks:
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import tango.io.Print, tango.text.locale.Common; void main() { Region region = new Region("en-GB"); Println("name: %s", region.name); Println("englishName: %s", region.englishName); Println("isMetric: %s", region.isMetric); Println("currencySymbol: %s", region.currencySymbol); Println("isoCurrencySymbol: %s", region.isoCurrencySymbol); } // Produces the following output. // name: en-GB // englishName: United Kingdom // isMetric: true // currencySymbol: £ // isoCurrencySymbol: GBP |
Parameters:
cultureID | A culture indentifier. |
Remarks:
Parameters:
name | A two-letter ISO 3166 code for the region. Or, a culture _name consisting of the language and region. |
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Returns:
Remarks:
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import tango.io.Print, tango.text.locale.Common; void main(char[][] args) { foreach (c; Culture.getCultures(CultureTypes.Specific)) { if (c.twoLetterLanguageName == "en") { NumberFormat fmt = c.numberFormat; Println("The currency symbol for %s is '%s'", c.englishName, fmt.currencySymbol); } } } // Produces the following output: // The currency symbol for English (United States) is '$' // The currency symbol for English (United Kingdom) is '£' // The currency symbol for English (Australia) is '$' // The currency symbol for English (Canada) is '$' // The currency symbol for English (New Zealand) is '$' // The currency symbol for English (Ireland) is '€' // The currency symbol for English (South Africa) is 'R' // The currency symbol for English (Jamaica) is 'J$' // The currency symbol for English (Caribbean) is '$' // The currency symbol for English (Belize) is 'BZ$' // The currency symbol for English (Trinidad and Tobago) is 'TT$' // The currency symbol for English (Zimbabwe) is 'Z$' // The currency symbol for English (Republic of the Philippines) is 'Php' |
Remarks:
Parameters:
type | The TypeInfo of the resulting formatting object. |
Returns:
Remarks:
Parameters:
formatService | The IFormatService used to retrieve NumberFormat. |
Returns:
Remarks:
Returns:
Returns:
Returns:
Returns:
Parameters:
value | The number of decimal places used for numbers. |
Throws:
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import tango.io.Print, tango.text.locale.Common; void main() { // Get the NumberFormat from the en-GB culture. NumberFormat fmt = (new Culture("en-GB")).numberFormat; // Display a value with the default number of decimal digits. int n = 5678; Println(Formatter.format(fmt, "{0:N}", n)); // Display the value with six decimal digits. fmt.numberDecimalDigits = 6; Println(Formatter.format(fmt, "{0:N}", n)); } // Produces the following output: // 5,678.00 // 5,678.000000 |
Returns:
Remarks:
Value | Pattern |
---|---|
0 | (n) |
1 | -n |
2 | - n |
3 | n- |
4 | n - |
Parameters:
value | The format pattern for negative numbers. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import tango.io.Print, tango.text.locale.Common; void main() { NumberFormat fmt = new NumberFormat; int n = -5678; // Display the default pattern. Println(Formatter.format(fmt, "{0:N}", n)); // Display all patterns. for (int i = 0; i <= 4; i++) { fmt.numberNegativePattern = i; Println(Formatter.format(fmt, "{0:N}", n)); } } // Produces the following output: // (5,678.00) // (5,678.00) // -5,678.00 // - 5,678.00 // 5,678.00- // 5,678.00 - |
Returns:
Parameters:
value | The number of decimal digits to use in currency values. |
Returns:
Parameters:
value | The format pattern to use for negative currency values. |
Returns:
Returns:
Returns:
Parameters:
value | The number of digits int each group to the left of the decimal place in numbers. |
Returns:
Parameters:
value | The number of digits int each group to the left of the decimal place in currency values. |
Returns:
Parameters:
value | The string separating groups of digits to the left of the decimal place in numbers. |
Returns:
Parameters:
value | The string used as the decimal separator in numbers. |
Returns:
Parameters:
value | The string separating groups of digits to the left of the decimal place in currency values. |
Returns:
Parameters:
value | The string used as the decimal separator in currency values. |
Returns:
Parameters:
value | The string used as the currency symbol. |
Returns:
Parameters:
value | The string denoting that a number is negative. |
Returns:
Parameters:
value | The string denoting that a number is positive. |
Returns:
Parameters:
value | The string representing the NaN value. |
Returns:
Parameters:
value | The string representing negative infinity. |
Returns:
Parameters:
value | The string representing positive infinity. |
Returns:
Parameters:
value | A string array of native equivalents of the digits 0 to 9. |
Remarks:
Parameters:
type | The TypeInfo of the resulting formatting object. |
Returns:
Remarks:
Returns:
Returns:
Parameters:
dayOfWeek | A DayOfWeek value. |
Returns:
Parameters:
dayOfWeek | A DayOfWeek value. |
Returns:
Parameters:
month | An integer between 1 and 13 indicating the name of the _month to return. |
Returns:
Parameters:
month | An integer between 1 and 13 indicating the name of the _month to return. |
Returns:
Parameters:
formatService | The IFormatService used to retrieve DateTimeFormat. |
Returns:
Remarks:
Returns:
Returns:
Returns:
Returns:
Parameters:
value | The Calendar determining the calendar to be used by the current culture. |
Exceptions:
Returns:
Parameters:
valie | A DayOfWeek value indicating the first day of the week. |
Returns:
Parameters:
value | A CalendarWeekRule _value determining the first week of the year. |
Returns:
Returns:
Parameters:
value | The string separating date components. |
Returns:
Parameters:
value | The string separating time components. |
Returns:
Parameters:
value | The string designator for hours before noon. |
Returns:
Parameters:
value | The string designator for hours after noon. |
Returns:
Parameters:
value | The format pattern for a short date _value. |
Returns:
Parameters:
value | The format pattern for a short time _value. |
Returns:
Parameters:
value | The format pattern for a long date _value. |
Returns:
Parameters:
value | The format pattern for a long time _value. |
Returns:
Parameters:
value | The format pattern for a month and day _value. |
Returns:
Parameters:
value | The format pattern for a year and month _value. |
Returns:
Parameters:
value | A string array containing the abbreviated names of the days of the week. |
Returns:
Parameters:
value | A string array containing the full names of the days of the week. |
Returns:
Parameters:
value | A string array containing the abbreviated names of the months. |
Returns:
Parameters:
value | A string array containing the full names of the months. |
Returns:
Parameters:
value | The format pattern for a long date and a long time _value. |
Returns:
Returns:
Returns: