|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dicom4j.core.utils.StringUtilities
public class StringUtilities
Various static methods helpful for comparing and manipulating strings.
| Method Summary | |
|---|---|
static int |
compareStringsThatMayBeIntegers(String s1,
String s2)
Compare strings based on their integer value of they are both integers, otherwise their lexicographic order. |
static int |
compareStringsWithEmbeddedNonZeroPaddedIntegers(String s1,
String s2)
Compare strings based on the lexicographic order of their values, but accounting for non-zero padded integers. |
static void |
main(String[] arg)
Unit testing. |
static String |
removeTrailingCharacter(String src,
char rmchar)
Remove any trailing instances of a particular character from a string. |
static String |
removeTrailingSpaces(String src)
Remove any trailing spaces from a string. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final int compareStringsThatMayBeIntegers(String s1,
String s2)
Compare strings based on their integer value of they are both integers, otherwise their lexicographic order.
For example, "001" and"1" would be treated
as equal, whilst "1" would be considered as occuring before
"10", which would not be the case with a simple
lexicographic ordering.
s1 - the first of two strings to be compareds2 - the first of two strings to be compared
public static final int compareStringsWithEmbeddedNonZeroPaddedIntegers(String s1,
String s2)
Compare strings based on the lexicographic order of their values, but accounting for non-zero padded integers.
Note that the comparison is more complex than a simple lexicographic
comparison of strings (as described in the definition of
java.lang.String.compareTo(String)
but rather accounts for embedded non-zero padded integers by treating
occurrences of space delimited integers as integer values rather than
strings. For example, "a 001 b" and"a 1 b"
would be treated as equal, whilst "a 1 b" would be
considered as occuring before "a 10 b", which would not be
the case with a simple lexicographic ordering.
s1 - the first of two strings to be compareds2 - the first of two strings to be compared
public static void main(String[] arg)
Unit testing.
arg - ignored
public static final String removeTrailingCharacter(String src,
char rmchar)
Remove any trailing instances of a particular character from a string.
src - the string that may have trailing spacesrmchar - the character, all trailing instances of which are to be removed
public static final String removeTrailingSpaces(String src)
Remove any trailing spaces from a string.
src - the string that may have trailing spaces
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||