public class ParamNameCompare
extends java.lang.Object
| Constructor and Description |
|---|
ParamNameCompare() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compareStrings(java.lang.String a1,
java.lang.String a2)
Compare two string for sorting.
|
static int |
findNonNumber(java.lang.String val)
Find the first non-numeric character in a string
|
static int |
findNumber(java.lang.String val)
Find the first numeric digit in a string
|
static boolean |
isNumber(java.lang.String val)
Check whether a string contains only digits
|
public static int compareStrings(java.lang.String a1,
java.lang.String a2)
If both strings are numeric (ex: 15 and 110), sort them numerically rather than alphabetically.
If both strings start with the same alphabetic prefix and end with a number (ex: PARM_15 and PARM_110), then sort the last part numerically.
Otherwise, sort the two strings alphabetically.
a1 - The first string to comparea2 - The second string to comparepublic static boolean isNumber(java.lang.String val)
val - The input stringpublic static int findNumber(java.lang.String val)
val - The input stringpublic static int findNonNumber(java.lang.String val)
val - The input string