public static int listFindIgnoreEmpty ( String list , String value , char delimiter ) { if ( list == null ) return - 1 ; int len = list . length ( ) ; if ( len == 0 ) return - 1 ; int last = 0 ; int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( list . charAt ( i ) == delimiter ) { if ( last < i ) { if ( list . substring ( last , i ) . equals ( value ) ) return count ; count ++ ; } last = i + 1 ; } } if ( last < len ) { if ( list . substring ( last ) . equals ( value ) ) return count ; } return - 1 ; }
finds a value inside a list case sensitive ignore empty items