public static String extractKey ( String input ) { int index = input . indexOf ( ' ' ) ; if ( - 1 == index ) { return input . trim ( ) ; } return input . substring ( 0 , index ) . trim ( ) ; }
Extract the key of a key = value pair contained withint the provided string . If no equals sign is found then the input is returned with white space trimmed .