|
@@ -812,82 +812,6 @@ |
812 |
812 |
|
return false; |
813 |
813 |
|
} |
814 |
814 |
|
|
815 |
|
- |
/** |
816 |
|
- |
* Is the string 'pInQuestion' made up of the 'pParts' where if only 1, then must be equal, otherwise |
817 |
|
- |
* the pInQuestion.startsWith(first) && pInQuestion.endsWith(last) && the middle must be found in |
818 |
|
- |
* order with no overlap between. |
819 |
|
- |
* |
820 |
|
- |
* @param pInQuestion - null will always return false |
821 |
|
- |
* @param pParts - Null treated as empty & Null Elements treated as "" |
822 |
|
- |
*/ |
823 |
|
- |
public static boolean isMadeUpFromParts( String pInQuestion, String[] pParts ) |
824 |
|
- |
{ |
825 |
|
- |
StringMatcher zSM = StringMatcherFactory.createEquals( pParts ); |
826 |
|
- |
return (zSM != null) && zSM.matches( pInQuestion ); |
827 |
|
- |
} |
828 |
|
- |
|
829 |
|
- |
public static int indexOfOrLength( String pToSearch, char pToFind ) |
830 |
|
- |
{ |
831 |
|
- |
return helperIndexOfOrLength( pToSearch, pToSearch.indexOf( pToFind ) ); |
832 |
|
- |
} |
833 |
|
- |
|
834 |
|
- |
public static int indexOfOrLength( String pToSearch, String pToFind ) |
835 |
|
- |
{ |
836 |
|
- |
return helperIndexOfOrLength( pToSearch, pToSearch.indexOf( pToFind ) ); |
837 |
|
- |
} |
838 |
|
- |
|
839 |
|
- |
private static int helperIndexOfOrLength( String pToSearch, int pAt ) |
840 |
|
- |
{ |
841 |
|
- |
return (pAt != -1) ? pAt : pToSearch.length(); |
842 |
|
- |
} |
843 |
|
- |
|
844 |
|
- |
// String Group |
845 |
|
- |
|
846 |
|
- |
public static String[] removeStringFromArray( String[] pArray, int pIndexToRemove ) |
847 |
|
- |
{ |
848 |
|
- |
if ( Objects.isNullOrEmpty( pArray ) || (pIndexToRemove < 0) || (pArray.length <= pIndexToRemove) ) |
849 |
|
- |
{ |
850 |
|
- |
return pArray; |
851 |
|
- |
} |
852 |
|
- |
int zNewLength = pArray.length - 1; |
853 |
|
- |
String[] zNewArray = new String[zNewLength]; |
854 |
|
- |
if ( pIndexToRemove != 0 ) |
855 |
|
- |
{ |
856 |
|
- |
System.arraycopy( pArray, 0, zNewArray, 0, pIndexToRemove ); |
857 |
|
- |
} |
858 |
|
- |
if ( pIndexToRemove != zNewLength ) |
859 |
|
- |
{ |
860 |
|
- |
System.arraycopy( pArray, pIndexToRemove + 1, zNewArray, pIndexToRemove, zNewLength - pIndexToRemove ); |
861 |
|
- |
} |
862 |
|
- |
return zNewArray; |
863 |
|
- |
} |
864 |
|
- |
|
865 |
|
- |
public static String[] appendStringArrays( String[] pArray1, String[] pArray2 ) |
866 |
|
- |
{ |
867 |
|
- |
if ( Objects.isNullOrEmpty( pArray2 ) ) |
868 |
|
- |
{ |
869 |
|
- |
return pArray1; |
870 |
|
- |
} |
871 |
|
- |
if ( Objects.isNullOrEmpty( pArray1 ) ) |
872 |
|
- |
{ |
873 |
|
- |
return pArray2; |
874 |
|
- |
} |
875 |
|
- |
String[] joined = new String[pArray1.length + pArray2.length]; |
876 |
|
- |
System.arraycopy( pArray1, 0, joined, 0, pArray1.length ); |
877 |
|
- |
System.arraycopy( pArray2, 0, joined, pArray1.length, pArray2.length ); |
878 |
|
- |
return joined; |
879 |
|
- |
} |
880 |
|
- |
|
881 |
|
- |
public static String[] prependString( String pNewFirst, String[] pTheRest ) |
882 |
|
- |
{ |
883 |
|
- |
return appendStringArrays( new String[]{pNewFirst}, pTheRest ); |
884 |
|
- |
} |
885 |
|
- |
|
886 |
|
- |
public static String[] appendString( String[] pCurArray, String pNewLast ) |
887 |
|
- |
{ |
888 |
|
- |
return appendStringArrays( pCurArray, new String[]{pNewLast} ); |
889 |
|
- |
} |
890 |
|
- |
|
891 |
815 |
|
public static String toStringNullToEmpty( Object pObject ) |
892 |
816 |
|
{ |
893 |
817 |
|
if ( pObject != null ) |