public class Extlib
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Extlib()
This class contains some additional method not contained
in the original Swiss Ephemeris package.
|
Modifier and Type | Method and Description |
---|---|
java.text.SimpleDateFormat |
createLocDateTimeFormatter(java.lang.String locString,
boolean force24h)
Creates a localized date time formatter suitable for tabular output with
4 digit years and UTC timezone.
|
java.lang.String |
getDecimalSeparator(java.text.NumberFormat nf)
Returns the decimal separator of the NumberFormat
|
java.util.Locale |
getLocale(java.lang.String locString)
Returns the requested locale from a locale string.
|
java.lang.String[] |
getLocales()
This method returns all available locale strings
|
java.lang.String |
getNormalizedDatePattern(java.lang.String pattern,
boolean force24h)
Ensures a date pattern with four letter year, two letter month and day
and 24h time format, if requested.
|
int |
getPatternLastIdx(java.lang.String pattern,
java.lang.String what,
java.text.SimpleDateFormat dof)
Returns the index in the formatter pattern of the given pattern 'what'
recalculated to the APPLIED pattern of the formatter.
|
static void |
main(java.lang.String[] argv)
This method is for debugging purposes only.
|
public Extlib()
public static void main(java.lang.String[] argv)
argv
- (unused parameter)public java.lang.String[] getLocales()
public java.util.Locale getLocale(java.lang.String locString)
locString
- A String describing the locale as a two letter
language code, a two letter language code plus a "_" plus a two
letter country code, or null or the empty string. Null or the
empty string will return the default locale, all others will
return the requested locale.public java.text.SimpleDateFormat createLocDateTimeFormatter(java.lang.String locString, boolean force24h)
SimpleDateFormat sdf = createLocDateTimeFormatter("da_DK", true);
SweDate sd = new SweDate(2005,3,27);
//...
System.out.println(sdf.format(sd.getDate(0)));
Years B.C. will be prefixed by a "-". Years are counted including year "0", which differs from normal DateFormat output.
locString
- The input locale for which this date time format
should be created. See getLocale() for more infos.force24h
- Force the use of the 24 hour date format even on 12h date formatspublic java.lang.String getNormalizedDatePattern(java.lang.String pattern, boolean force24h)
pattern
- The date pattern to be normalizedforce24h
- Force the use of the 24 hour date format even on 12h date formatspublic java.lang.String getDecimalSeparator(java.text.NumberFormat nf)
nf
- NumberFormat for which the decimal separator should be retrievedpublic int getPatternLastIdx(java.lang.String pattern, java.lang.String what, java.text.SimpleDateFormat dof)
pattern
- Date patternwhat
- Search for this String in the patterndof
- The DateFormat to be used