private static String removeSubjLeaders(String subject){
  int subString=0;
  while (subject.charAt(subString) == WS) {
    subString++;
  }
  if (subString > 0) {
    return subject.substring(subString);
  }
 else {
    String subj=removeSubjectBlob(subject);
    String lowCaseSubj=subj.toLowerCase(Locale.US);
    if (lowCaseSubj.startsWith(RE)) {
      subString=RE.length();
    }
 else     if (lowCaseSubj.startsWith(FWD)) {
      subString=FWD.length();
    }
 else     if (lowCaseSubj.startsWith(FW)) {
      subString=FW.length();
    }
 else {
      return subject;
    }
    while (subj.charAt(subString) == WS) {
      subString++;
    }
    if (subj.charAt(subString) == COLON) {
      subString++;
    }
 else {
      return subject;
    }
    while (subj.charAt(subString) == WS) {
      subString++;
    }
    return subj.substring(subString);
  }
}

private static String removeSubjLeaders ( String subject ) { int subString = 0 ; while ( subject . charAt ( subString ) == WS ) { subString ++ ; } if ( subString > 0 ) { return subject . substring ( subString ) ; } else { String subj = removeSubjectBlob ( subject ) ; String lowCaseSubj = subj . toLowerCase ( Locale . US ) ; if ( lowCaseSubj . startsWith ( RE ) ) { subString = RE . length ( ) ; } else if ( lowCaseSubj . startsWith ( FWD ) ) { subString = FWD . length ( ) ; } else if ( lowCaseSubj . startsWith ( FW ) ) { subString = FW . length ( ) ; } else { return subject ; } while ( subj . charAt ( subString ) == WS ) { subString ++ ; } if ( subj . charAt ( subString ) == COLON ) { subString ++ ; } else { return subject ; } while ( subj . charAt ( subString ) == WS ) { subString ++ ; } return subj . substring ( subString ) ; } }
remove the subj - leader subj - leader = ( * subj - blob subj - refwd ) / wsp subj - blob = " [ " * blobchar " ] " * wsp subj - refwd = ( " re " / ( " fw " [ " d " ] ) ) * wsp [ subj - blob ] " : " blobchar = % x01 - 5a / % x5c / % x5e - 7f ; any char except ' [ ' and ' ] '
