public static String getFirstToken ( String string , String token ) { if ( ( string != null ) && string . contains ( token ) ) { return string . split ( token ) [ 0 ] ; } return string ; }
Returns the first token of the string if that string can be split by the token else return the unmodified input string