public String[] parseForHeader(String string){
  if (string.length() >= 7 && string.startsWith("[") && string.endsWith("]")) {
    int quoteIndex=string.indexOf('\"');
    if (quoteIndex != -1) {
      int quote2Index=string.lastIndexOf('\"');
      if (quote2Index > quoteIndex && RaptorStringUtils.count(string,'\"') == 2 && quote2Index + 2 == string.length()) {
        int spaceIndex=string.indexOf(' ');
        if (spaceIndex != -1 && spaceIndex < quoteIndex && spaceIndex >= 2) {
          return new String[]{string.substring(1,spaceIndex),string.substring(quoteIndex + 1,quote2Index)};
        }
      }
    }
  }
  return null;
}

public String [ ] parseForHeader ( String string ) { if ( string . length ( ) >= 7 && string . startsWith ( "[" ) && string . endsWith ( "]" ) ) { int quoteIndex = string . indexOf ( '\"' ) ; if ( quoteIndex != - 1 ) { int quote2Index = string . lastIndexOf ( '\"' ) ; if ( quote2Index > quoteIndex && RaptorStringUtils . count ( string , '\"' ) == 2 && quote2Index + 2 == string . length ( ) ) { int spaceIndex = string . indexOf ( ' ' ) ; if ( spaceIndex != - 1 && spaceIndex < quoteIndex && spaceIndex >= 2 ) { return new String [ ] { string . substring ( 1 , spaceIndex ) , string . substring ( quoteIndex + 1 , quote2Index ) } ; } } } } return null ; }
returns null if string is not a header , otherwise returns a string [ 2 ] where index 0 is header name , and index1 is the value . this method is fast and does ' nt use regex for parsing .
