|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tig.Strings
Class containing utility static methods for String
manipulation.
Field Summary |
Fields inherited from interface tig.GeneralConstants |
BLANK, FS, LS, NO_SPECIF, SPACE |
Constructor Summary | |
Strings()
|
Method Summary | |
static java.lang.String |
doubleArrayToString(double[] doubleArray)
Converts a double[] to a String.
|
static int |
findIndex(java.lang.String[] array,
java.lang.String s)
Finds the position of a String in an array (a String[] ). |
static java.lang.String |
intArrayToString(int[] intArray)
Converts a int[] to a String.
|
static double |
parseDouble(java.lang.String s)
Equivalent to java.lang.Double.parseDouble(String) , but more permissive.
|
static java.lang.String |
replace(java.lang.String theString,
java.lang.String s1,
java.lang.String s2)
All occurences of 's1' contained in 'theString' are replaced by s2. |
static double[] |
stringToDoubleArray(java.lang.String str)
Converts a String to an double[] ; in the String , the doubles must be
separated by comas (',').
|
static int[] |
stringToIntArray(java.lang.String str)
Converts a String to an int[] ; in the String , the integers must be
separated by comas (',').
|
static java.lang.String[] |
stringToStringArray(java.lang.String s)
Convenient method to call stringToStringArray(String, char) ,
using a coma (',') as separator. |
static java.lang.String[] |
stringToStringArray(java.lang.String s,
char separator)
Transforms a String in an array of String s.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Strings()
Method Detail |
public static int findIndex(java.lang.String[] array, java.lang.String s)
String
in an array (a String[]
).
array
- Arry of Strings where String 's' is searched.s
- String we want to locate in array
s
in array
, or GeneralConstants.NO_SPECIF
if not found.public static java.lang.String[] stringToStringArray(java.lang.String s)
stringToStringArray(String, char)
,
using a coma (',') as separator.
public static java.lang.String[] stringToStringArray(java.lang.String s, char separator)
String
in an array of String
s.
s = "arg1, arg2,arg3 "
and separator = ','
,
stringToStringArray
returns :
arg1 | arg2 | arg3 |
arg2
and arg3
).s
lead to creation
of empty Strings in the resulting array.s=",arg1,, arg2,arg3"
, stringToStringArray
returns :
(empty String) | arg1 | (empty String) | arg2 | arg3 |
s
- String to analyze.separator
- Character used as separator to analyze s
.
public static java.lang.String intArrayToString(int[] intArray)
int[]
to a String.
public static int[] stringToIntArray(java.lang.String str)
int[]
; in the String
, the integers must be
separated by comas (',').
new int[]{1, 4, -9, 0}
.
java.lang.NumberFormatException
- If elements of 'str' can't be converted to integers.public static java.lang.String doubleArrayToString(double[] doubleArray)
double[]
to a String.
public static double[] stringToDoubleArray(java.lang.String str)
double[]
; in the String
, the doubles must be
separated by comas (',').
new double[]{1.0, 4.02, -9.3, 0.0}
.
java.lang.NumberFormatException
- If elements of 'str' can't be converted to doubles.public static double parseDouble(java.lang.String s)
java.lang.Double.parseDouble(String)
, but more permissive.
The string is converted to a double if the separator is a point or a coma.
parseDouble("12.34")
and parseDouble("12,34")
will return the double
12.34
.
s
- The String that this method tries to convert into a double
.
java.lang.NumberFormatException
- If 's' can't be parsed.public static java.lang.String replace(java.lang.String theString, java.lang.String s1, java.lang.String s2)
java.lang.String.replace(char, char)
, but with Strings.
theString
- String to be modified.s1
- substring of 'theString' to be replaced by 's2'.s2
- String used to replace 's1' in 'theString'.
|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |