private boolean doesMatchFullName ( String firstName , String fullName ) { boolean matching = false ; if ( firstName != null && ! firstName . isEmpty ( ) && fullName != null && ! fullName . isEmpty ( ) ) { String firstFromCMDB ; String [ ] array = fullName . split ( " " ) ; firstName = firstName . toLowerCase ( ) ; firstFromCMDB = array [ 0 ] ; firstFromCMDB = firstFromCMDB . toLowerCase ( ) ; if ( firstFromCMDB . length ( ) < firstName . length ( ) ) { if ( firstName . indexOf ( firstFromCMDB ) != - 1 ) { matching = true ; } } else if ( firstFromCMDB . indexOf ( firstName ) != - 1 ) { matching = true ; } } return matching ; }
Takes first name and full name and returns true or false if first name is found in full name