private void parse ( String input ) { char [ ] data = input . toCharArray ( ) ; int start = 0 ; int hard_stop = data . length - 1 ; while ( start < data . length ) { if ( this . mySep == data [ start ] ) { start ++ ; continue ; } // look for the '=', end of data, or the separator int end = start ; String key = null ; boolean insideQuotes = false ; while ( end < data . length ) { boolean extract = false ; if ( ' ' == data [ end ] ) { insideQuotes = ! insideQuotes ; } else if ( this . mySep == data [ end ] ) { extract = true ; end -- ; } else if ( ' ' == data [ end ] ) { // found a key key = extractString ( data , start , end - 1 ) ; end ++ ; // past the '=' start = end ; continue ; } // if we're on the last character then always extract and quit if ( end == hard_stop ) { extract = true ; } // if we need to, extract the value and continue if ( extract ) { String value = extractString ( data , start , end ) ; if ( null == key ) { addElement ( value ) ; } else { addElement ( key , value ) ; } // at this point, end is pointing to the last char of the val end = end + 2 ; // jump past delim start = end ; if ( ! insideQuotes ) { break ; // out of while } continue ; } end ++ ; } } }
Parse the input string for all value possibilities .