Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.core
Class QLocale

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QLocale

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QLocale

extends QtJambiObject
implements java.lang.Cloneable

The QLocale class converts between numbers and their string representations in various languages. QLocale is initialized with a language/country pair in its constructor and offers number-to-string and string-to-number conversion functions similar to those in QString.

Example:

            QLocale egyptian = new QLocale(QLocale.Language.Arabic, QLocale.Country.Egypt);
            String s1 = egyptian.toString(1.571429E+07, (byte) 'e');
            String s2 = egyptian.toString(10);

            double d = egyptian.toDouble(s1);
            int i = egyptian.toInt(s2);

QLocale supports the concept of a default locale, which is determined from the system's locale settings at application startup. The default locale can be changed by calling the static member `setDefault()`. Setting the default locale has the following effects:

- If a QLocale object is constructed with the default constructor, it will use the default locale's settings.
- QString::toInt(), QString::toDouble(), etc., interpret the string according to the default locale. If this fails, it falls back on the "C" locale.
- QString::arg() uses the default locale to format a number when its position specifier in the format string contains an 'L', e.g. "%L1".

The following example illustrates how to use QLocale directly:

            QLocale.setDefault(new QLocale(QLocale.Language.Hebrew, QLocale.Country.Israel));
            QLocale hebrew = new QLocale(); // Constructs a default QLocale
            String s1 = hebrew.toString(15714.3, (byte) 'e');

            double d;

            d = hebrew.toDouble("1234,56");   // d == 0.0
            d = hebrew.toDouble("1234.56");   // d == 1234.56

When a language/country pair is specified in the constructor, one of three things can happen:

- If the language/country pair is found in the database, it is used.
- If the language is found but the country is not, or if the country is `AnyCountry`, the language is used with the most appropriate available country (for example, Germany for German),
- If neither the language nor the country are found, QLocale defaults to the default locale (see `setDefault()`).

The "C" locale is identical to `English` /`UnitedStates` .

Use `language()` and `country()` to determine the actual language and country values used.

An alternative method for constructing a QLocale object is by specifying the locale name.

            QLocale korean = new QLocale("ko");
            QLocale swiss = new QLocale("de_CH");

This constructor converts the locale name to a language/country pair; it does not use the system locale database.

The double-to-string and string-to-double conversion functions are covered by the following licenses:Copyright (c) 1991 by AT&T.Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software.THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.This product includes software developed by the University of California, Berkeley and its contributors.QLocale's data is based on Common Locale Data Repository v1.4.

See also:
  QString::arg(), QString::toInt(), and QString::toDouble().

Nested Class Summary
`static class` | `QLocale.Country` This enumerated type is used to specify a country.
`static class` | `QLocale.FormatType` This enum describes the types of format that can be used when converting `QDate` and `QTime` objects to strings.
`static class` | `QLocale.Language` This enumerated type is used to specify a language.
`static class` | `QLocale.MeasurementSystem` This enum defines which units are used for measurement.
`static class` | `QLocale.NumberOption` This enum defines a set of options for number-to-string and string-to-number conversions.
`static class` | `QLocale.NumberOptions`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QLocale()` Constructs a QLocale object initialized with the default locale.
`QLocale(QLocale.Language language)` Constructs a QLocale object with the specified `language` and `country`.
`QLocale(QLocale.Language language, QLocale.Country country)` Constructs a QLocale object with the specified `language` and `country`.
`QLocale(QLocale other)` Constructs a QLocale object as a copy of `other`.
`QLocale(java.lang.String name)` Constructs a QLocale object with the specified `name`, which has the format "language[_country][.

Method Summary
`static QLocale` | `c()` Returns a QLocale object initialized to the "C" locale.
`QLocale` | `clone()` This method is reimplemented for internal reasons
`static java.util.List` | `countriesForLanguage(QLocale.Language lang)` Returns the list of countries that have entires for `language` in Qt's locale database.
`QLocale.Country` | `country()` Returns the country of this locale.
`static java.lang.String` | `countryToString(QLocale.Country country)` Returns a QString containing the name of `country`.
`java.lang.String` | `dateFormat()` Returns the date format used for the current locale.
`java.lang.String` | `dateFormat(QLocale.FormatType format)` Returns the date format used for the current locale.
`java.lang.String` | `dateTimeFormat()` Returns the date time format used for the current locale.
`java.lang.String` | `dateTimeFormat(QLocale.FormatType format)` Returns the date time format used for the current locale.
`java.lang.String` | `dayName(int arg__1)` Returns the localized name of `day`, in the format specified by `type`.
`java.lang.String` | `dayName(int arg__1, QLocale.FormatType format)` Returns the localized name of `day`, in the format specified by `type`.
`char` | `decimalPoint()` Returns the decimal point character of this locale.
`char` | `exponential()` Returns the exponential character of this locale.
`char` | `groupSeparator()` Returns the group separator character of this locale.
`QLocale.Language` | `language()` Returns the language of this locale.
`static java.lang.String` | `languageToString(QLocale.Language language)` Returns a QString containing the name of `language`.
`QLocale.MeasurementSystem` | `measurementSystem()` Returns the measurement system for the locale.
`java.lang.String` | `monthName(int arg__1)` Returns the localized name of `month`, in the format specified by `type`.
`java.lang.String` | `monthName(int arg__1, QLocale.FormatType format)` Returns the localized name of `month`, in the format specified by `type`.
`java.lang.String` | `name()` Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two-letter ISO 3166 country code.
`char` | `negativeSign()` Returns the negative sign character of this locale.
`QLocale.NumberOptions` | `numberOptions()` Returns the options related to number conversions for this QLocale instance.
`char` | `percent()` Returns the percent character of this locale.
`void` | `readFrom(QDataStream arg__1)` Reads a QLocale
`static void` | `setDefault(QLocale locale)` Sets the global default locale to `locale`.
`void` | `setNumberOptions(QLocale.NumberOption[] options)`
`void` | `setNumberOptions(QLocale.NumberOptions options)` Sets the `options` related to number conversions for this QLocale instance.
`static QLocale` | `system()` Returns a QLocale object initialized to the system locale.
`java.lang.String` | `timeFormat()` Returns the time format used for the current locale.
`java.lang.String` | `timeFormat(QLocale.FormatType format)` Returns the time format used for the current locale.
`char` | `toChar(java.lang.String s)` Returns the char, which must be written as a number between 0 and 255, represented by the localized string `s`.
`char` | `toChar(java.lang.String s, int base)` Returns the char, which must be written as a number between 0 and 255, represented by the localized string `s`, using base `base`.
`QDate` | `toDate(java.lang.String string)` Parses the date string given in `string` and returns the date.
`QDate` | `toDate(java.lang.String string, QLocale.FormatType arg__2)` Parses the date string given in `string` and returns the date.
`QDate` | `toDate(java.lang.String string, java.lang.String format)` Parses the date string given in `string` and returns the date.
`QDateTime` | `toDateTime(java.lang.String string)` Parses the date/time string given in `string` and returns the time.
`QDateTime` | `toDateTime(java.lang.String string, QLocale.FormatType format)` Parses the date/time string given in `string` and returns the time.
`QDateTime` | `toDateTime(java.lang.String string, java.lang.String format)` Parses the date/time string given in `string` and returns the time.
`double` | `toDouble(java.lang.String s)` Returns the double represented by the localized string `s`, or 0.0 if the conversion failed.
`float` | `toFloat(java.lang.String s)` Returns the float represented by the localized string `s`, or 0.0 if the conversion failed.
`int` | `toInt(java.lang.String s)` Returns the int represented by the localized string `s`, using base 10.
`int` | `toInt(java.lang.String s, int base)` Returns the int represented by the localized string `s`, using base `base`.
`long` | `toLong(java.lang.String s)` Returns the long represented by the localized string `s`, using base 10.
`long` | `toLong(java.lang.String s, int base)` Returns the long represented by the localized string `s`, using base `base`.
`short` | `toShort(java.lang.String s)` Returns the short represented by the localized string `s`.
`short` | `toShort(java.lang.String s, int base)` Returns the short represented by the localized string `s`, using base `base`.
`java.lang.String` | `toString(char i)` Returns a string representation of the `char` argument.
`java.lang.String` | `toString(double i)` Returns a string representation of the `double` argument.
`java.lang.String` | `toString(double i, byte f)` Returns a string representation of the `double` argument.
`java.lang.String` | `toString(double i, byte f, int prec)` Returns a string representation of the `double` argument.
`java.lang.String` | `toString(float i)` Returns a string representation of the `float` argument.
`java.lang.String` | `toString(float i, byte f)` Returns a string representation of the `float` argument.
`java.lang.String` | `toString(float i, byte f, int prec)` Returns a string representation of the `float` argument.
`java.lang.String` | `toString(int i)` Returns a string representation of the `int` argument.
`java.lang.String` | `toString(long i)` Returns a string representation of the `long` argument.
`java.lang.String` | `toString(QDate date)` Returns a string representation of the `com.trolltech.qt.core.QDate` argument.
`java.lang.String` | `toString(QDate date, QLocale.FormatType format)`
`java.lang.String` | `toString(QDate date, java.lang.String formatStr)`
`java.lang.String` | `toString(QDateTime dateTime)` Returns a string representation of the `com.trolltech.qt.core.QDateTime` argument.
`java.lang.String` | `toString(QDateTime dateTime, QLocale.FormatType format)` Returns a string representation of the `com.trolltech.qt.core.QDate` argument.
`java.lang.String` | `toString(QDateTime dateTime, java.lang.String format)` Returns a string representation of the `com.trolltech.qt.core.QDate` argument.
`java.lang.String` | `toString(QTime time)` Returns a string representation of the `com.trolltech.qt.core.QTime` argument.
`java.lang.String` | `toString(QTime time, QLocale.FormatType format)` Returns a string representation of the `com.trolltech.qt.core.QTime` argument.
`java.lang.String` | `toString(QTime time, java.lang.String formatStr)` Returns a string representation of the `com.trolltech.qt.core.QTime` argument.
`QTime` | `toTime(java.lang.String string)` Parses the time string given in `string` and returns the time.
`QTime` | `toTime(java.lang.String string, QLocale.FormatType arg__2)` Parses the time string given in `string` and returns the time.
`QTime` | `toTime(java.lang.String string, java.lang.String format)` Parses the time string given in `string` and returns the time.
`void` | `writeTo(QDataStream arg__1)` Writes thisQLocale
`char` | `zeroDigit()` Returns the zero digit character of this locale.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QLocale

    public QLocale()

  Constructs a QLocale object initialized with the default locale. If no default locale was set using setDefaultLocale(), this locale will be the same as the one returned by `system()`.

See also:
  `setDefault()`.

### QLocale

    public QLocale(QLocale.Language language)

  Constructs a QLocale object with the specified `language` and `country`.
  - If the language/country pair is found in the database, it is used.
  - If the language is found but the country is not, or if the country is `AnyCountry`, the language is used with the most appropriate available country (for example, Germany for German),
  - If neither the language nor the country are found, QLocale defaults to the default locale (see `setDefault()`).
  The language and country that are actually used can be queried using `language()` and `country()`.

See also:
  `setDefault()`, `language()`, and `country()`.

### QLocale

    public QLocale(QLocale.Language language,
                   QLocale.Country country)

  Constructs a QLocale object with the specified `language` and `country`.
  - If the language/country pair is found in the database, it is used.
  - If the language is found but the country is not, or if the country is `AnyCountry`, the language is used with the most appropriate available country (for example, Germany for German),
  - If neither the language nor the country are found, QLocale defaults to the default locale (see `setDefault()`).
  The language and country that are actually used can be queried using `language()` and `country()`.

See also:
  `setDefault()`, `language()`, and `country()`.

### QLocale

    public QLocale(QLocale other)

  Constructs a QLocale object as a copy of `other`.

### QLocale

    public QLocale(java.lang.String name)

  Constructs a QLocale object with the specified `name`, which has the format "language[_country][. odeset][@modifier]" or "C", where:
  - language is a lowercase, two-letter, ISO 639 language code,
  - territory is an uppercase, two-letter, ISO 3166 country code,
  - and codeset and modifier are ignored.
  If the string violates the locale format, or language is not a valid ISO 369 code, the "C" locale is used instead. If country is not present, or is not a valid ISO 3166 code, the most appropriate country is chosen for the specified language.

  The language and country codes are converted to their respective `Language` and `Country` enums. After this conversion is performed the constructor behaves exactly like QLocale(Country, Language).

  This constructor is much slower than QLocale(Country, Language).

See also:
  `name()`.

Method Detail

### country

    public final QLocale.Country country()

  Returns the country of this locale.

See also:
  `language()`, `countryToString()`, and `name()`.

### dateFormat

    public final java.lang.String dateFormat()

  Returns the date format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QDate::toString()`, and `QDate::fromString()`.

### dateFormat

    public final java.lang.String dateFormat(QLocale.FormatType format)

  Returns the date format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QDate::toString()`, and `QDate::fromString()`.

### dateTimeFormat

    public final java.lang.String dateTimeFormat()

  Returns the date time format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QDateTime::toString()`, and `QDateTime::fromString()`.

### dateTimeFormat

    public final java.lang.String dateTimeFormat(QLocale.FormatType format)

  Returns the date time format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QDateTime::toString()`, and `QDateTime::fromString()`.

### dayName

    public final java.lang.String dayName(int arg__1)

  Returns the localized name of `day`, in the format specified by `type`.

See also:
  `monthName()`.

### dayName

    public final java.lang.String dayName(int arg__1,
                                          QLocale.FormatType format)

  Returns the localized name of `day`, in the format specified by `type`.

See also:
  `monthName()`.

### decimalPoint

    public final char decimalPoint()

  Returns the decimal point character of this locale.

### exponential

    public final char exponential()

  Returns the exponential character of this locale.

### groupSeparator

    public final char groupSeparator()

  Returns the group separator character of this locale.

### language

    public final QLocale.Language language()

  Returns the language of this locale.

See also:
  `country()`, `languageToString()`, and `name()`.

### measurementSystem

    public final QLocale.MeasurementSystem measurementSystem()

  Returns the measurement system for the locale.

### monthName

    public final java.lang.String monthName(int arg__1)

  Returns the localized name of `month`, in the format specified by `type`.

See also:
  `dayName()`.

### monthName

    public final java.lang.String monthName(int arg__1,
                                            QLocale.FormatType format)

  Returns the localized name of `month`, in the format specified by `type`.

See also:
  `dayName()`.

### name

    public final java.lang.String name()

  Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two-letter ISO 3166 country code.

See also:
  `language()`, and `country()`.

### negativeSign

    public final char negativeSign()

  Returns the negative sign character of this locale.

### numberOptions

    public final QLocale.NumberOptions numberOptions()

  Returns the options related to number conversions for this QLocale instance.

  By default, no options are set for the standard locales.

See also:
  `setNumberOptions()`.

### writeTo

    public final void writeTo(QDataStream arg__1)

  Writes thisQLocale

### readFrom

    public final void readFrom(QDataStream arg__1)

  Reads a QLocale

### percent

    public final char percent()

  Returns the percent character of this locale.

### setNumberOptions

    public final void setNumberOptions(QLocale.NumberOption[] options)

### setNumberOptions

    public final void setNumberOptions(QLocale.NumberOptions options)

  Sets the `options` related to number conversions for this QLocale instance.

See also:
  `numberOptions()`.

### timeFormat

    public final java.lang.String timeFormat()

  Returns the time format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QTime::toString()`, and `QTime::fromString()`.

### timeFormat

    public final java.lang.String timeFormat(QLocale.FormatType format)

  Returns the time format used for the current locale.

  If `format` is `ShortFormat` the format will be a short version. Otherwise it uses a longer version.

See also:
  `QTime::toString()`, and `QTime::fromString()`.

### toDate

    public final QDate toDate(java.lang.String string)

  Parses the date string given in `string` and returns the date. The format of the date string is chosen according to the `format` parameter (see `dateFormat()`).

  If the date could not be parsed, returns an invalid date.

See also:
  `dateFormat()`, `toTime()`, `toDateTime()`, and `QDate::fromString()`.

### toDate

    public final QDate toDate(java.lang.String string,
                              QLocale.FormatType arg__2)

  Parses the date string given in `string` and returns the date. The format of the date string is chosen according to the `format` parameter (see `dateFormat()`).

  If the date could not be parsed, returns an invalid date.

See also:
  `dateFormat()`, `toTime()`, `toDateTime()`, and `QDate::fromString()`.

### toDate

    public final QDate toDate(java.lang.String string,
                              java.lang.String format)

  Parses the date string given in `string` and returns the date. See `QDate::fromString()` for information on the expressions that can be used with this function.

  This function searches month names and the names of the days of the week in the current locale.

  If the date could not be parsed, returns an invalid date.

See also:
  `dateFormat()`, `toTime()`, `toDateTime()`, and `QDate::fromString()`.

### toDateTime

    public final QDateTime toDateTime(java.lang.String string)

  Parses the date/time string given in `string` and returns the time. The format of the date/time string is chosen according to the `format` parameter (see `dateTimeFormat()`).

  If the string could not be parsed, returns an invalid `QDateTime`.

See also:
  `dateTimeFormat()`, `toTime()`, `toDate()`, and `QDateTime::fromString()`.

### toDateTime

    public final QDateTime toDateTime(java.lang.String string,
                                      QLocale.FormatType format)

  Parses the date/time string given in `string` and returns the time. The format of the date/time string is chosen according to the `format` parameter (see `dateTimeFormat()`).

  If the string could not be parsed, returns an invalid `QDateTime`.

See also:
  `dateTimeFormat()`, `toTime()`, `toDate()`, and `QDateTime::fromString()`.

### toDateTime

    public final QDateTime toDateTime(java.lang.String string,
                                      java.lang.String format)

  Parses the date/time string given in `string` and returns the time. See `QDateTime::fromString()` for information on the expressions that can be used with this function.

  Note: The month and day names used must be given in the user's local language.

  If the string could not be parsed, returns an invalid `QDateTime`.

See also:
  `dateTimeFormat()`, `toTime()`, `toDate()`, and `QDateTime::fromString()`.

### toString

    public final java.lang.String toString(QDate date)

  Returns a string representation of the `com.trolltech.qt.core.QDate` argument.

### toString

    public final java.lang.String toString(QDate date,
                                           QLocale.FormatType format)

### toString

    public final java.lang.String toString(QDate date,
                                           java.lang.String formatStr)

### toString

    public final java.lang.String toString(QDateTime dateTime)

  Returns a string representation of the `com.trolltech.qt.core.QDateTime` argument.

### toString

    public final java.lang.String toString(QDateTime dateTime,
                                           QLocale.FormatType format)

  Returns a string representation of the `com.trolltech.qt.core.QDate` argument.

### toString

    public final java.lang.String toString(QDateTime dateTime,
                                           java.lang.String format)

  Returns a string representation of the `com.trolltech.qt.core.QDate` argument.

### toString

    public final java.lang.String toString(QTime time)

  Returns a string representation of the `com.trolltech.qt.core.QTime` argument.

### toString

    public final java.lang.String toString(QTime time,
                                           QLocale.FormatType format)

  Returns a string representation of the `com.trolltech.qt.core.QTime` argument.

### toString

    public final java.lang.String toString(QTime time,
                                           java.lang.String formatStr)

  Returns a string representation of the `com.trolltech.qt.core.QTime` argument.

### toString

    public final java.lang.String toString(double i,
                                           byte f)

  Returns a string representation of the `double` argument.

### toString

    public final java.lang.String toString(double i)

  Returns a string representation of the `double` argument.

### toString

    public final java.lang.String toString(double i,
                                           byte f,
                                           int prec)

  Returns a string representation of the `double` argument.

### toString

    public final java.lang.String toString(float i,
                                           byte f)

  Returns a string representation of the `float` argument.

### toString

    public final java.lang.String toString(float i)

  Returns a string representation of the `float` argument.

### toString

    public final java.lang.String toString(float i,
                                           byte f,
                                           int prec)

  Returns a string representation of the `float` argument.

### toString

    public final java.lang.String toString(int i)

  Returns a string representation of the `int` argument.

### toString

    public final java.lang.String toString(long i)

  Returns a string representation of the `long` argument.

### toString

    public final java.lang.String toString(char i)

  Returns a string representation of the `char` argument.

### toTime

    public final QTime toTime(java.lang.String string)

  Parses the time string given in `string` and returns the time. The format of the time string is chosen according to the `format` parameter (see `timeFormat()`).

  If the time could not be parsed, returns an invalid time.

See also:
  `timeFormat()`, `toDate()`, `toDateTime()`, and `QTime::fromString()`.

### toTime

    public final QTime toTime(java.lang.String string,
                              QLocale.FormatType arg__2)

  Parses the time string given in `string` and returns the time. The format of the time string is chosen according to the `format` parameter (see `timeFormat()`).

  If the time could not be parsed, returns an invalid time.

See also:
  `timeFormat()`, `toDate()`, `toDateTime()`, and `QTime::fromString()`.

### toTime

    public final QTime toTime(java.lang.String string,
                              java.lang.String format)

  Parses the time string given in `string` and returns the time. See `QTime::fromString()` for information on what is a valid format string.

  If the time could not be parsed, returns an invalid time.

See also:
  `timeFormat()`, `toDate()`, `toDateTime()`, and `QTime::fromString()`.

### zeroDigit

    public final char zeroDigit()

  Returns the zero digit character of this locale.

### c

    public static QLocale c()

  Returns a QLocale object initialized to the "C" locale.

See also:
  `system()`.

### countriesForLanguage

    public static java.util.List countriesForLanguage(QLocale.Language lang)

  Returns the list of countries that have entires for `language` in Qt's locale database. If the result is an empty list, then `language` is not represented in Qt's locale database.

### countryToString

    public static java.lang.String countryToString(QLocale.Country country)

  Returns a QString containing the name of `country`.

See also:
  `country()`, and `name()`.

### languageToString

    public static java.lang.String languageToString(QLocale.Language language)

  Returns a QString containing the name of `language`.

See also:
  `countryToString()`, and `name()`.

### setDefault

    public static void setDefault(QLocale locale)

  Sets the global default locale to `locale`. These values are used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.

  Warning: In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created.

See also:
  `system()`, and `c()`.

### system

    public static QLocale system()

  Returns a QLocale object initialized to the system locale.

  On Windows and Mac, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel.

See also:
  QTextCodec::locale(), and `c()`.

### toDouble

    public final double toDouble(java.lang.String s)

  Returns the double represented by the localized string `s`, or 0.0 if the conversion failed. This function ignores leading and trailing whitespace.

### toFloat

    public final float toFloat(java.lang.String s)

  Returns the float represented by the localized string `s`, or 0.0 if the conversion failed. This function ignores leading and trailing whitespace.

### toInt

    public final int toInt(java.lang.String s,
                           int base)

  Returns the int represented by the localized string `s`, using base `base`. If `base` is 0 the base is determined automatically using the following rules: If the string begins with "0x", it is assumed to be hexadecimal; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal. If the conversion fails the function returns 0. This function ignores leading and trailing whitespace.

### toInt

    public final int toInt(java.lang.String s)

  Returns the int represented by the localized string `s`, using base 10.

### toLong

    public final long toLong(java.lang.String s,
                             int base)

  Returns the long represented by the localized string `s`, using base `base`. If `base` is 0 the base is determined automatically using the following rules: If the string begins with "0x", it is assumed to be hexadecimal; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal. If the conversion fails the function returns 0. This function ignores leading and trailing whitespace.

### toLong

    public final long toLong(java.lang.String s)

  Returns the long represented by the localized string `s`, using base 10.

### toShort

    public final short toShort(java.lang.String s,
                               int base)

  Returns the short represented by the localized string `s`, using base `base`. If `base` is 0 the base is determined automatically using the following rules: If the string begins with "0x", it is assumed to be hexadecimal; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal. If the conversion fails the function returns 0. This function ignores leading and trailing whitespace.

### toShort

    public final short toShort(java.lang.String s)

  Returns the short represented by the localized string `s`. The string is interpreted as a decimal number.

### toChar

    public final char toChar(java.lang.String s,
                             int base)

  Returns the char, which must be written as a number between 0 and 255, represented by the localized string `s`, using base `base`. If `base` is 0 the base is determined automatically using the following rules: If the string begins with "0x", it is assumed to be hexadecimal; if it begins with "0", it is assumed to be octal; otherwise it is assumed to be decimal. If the conversion fails the function returns 0. This function ignores leading and trailing whitespace.

### toChar

    public final char toChar(java.lang.String s)

  Returns the char, which must be written as a number between 0 and 255, represented by the localized string `s`. The number is assumed to be decimal.

### clone

    public QLocale clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD