public static String removeColors(String line){
  int length=line.length();
  StringBuffer buffer=new StringBuffer();
  int i=0;
  while (i < length) {
    char ch=line.charAt(i);
    if (ch == '\u0003') {
      i++;
      if (i < length) {
        ch=line.charAt(i);
        if (Character.isDigit(ch)) {
          i++;
          if (i < length) {
            ch=line.charAt(i);
            if (Character.isDigit(ch)) {
              i++;
            }
          }
          if (i < length) {
            ch=line.charAt(i);
            if (ch == ',') {
              i++;
              if (i < length) {
                ch=line.charAt(i);
                if (Character.isDigit(ch)) {
                  i++;
                  if (i < length) {
                    ch=line.charAt(i);
                    if (Character.isDigit(ch)) {
                      i++;
                    }
                  }
                }
 else {
                  i--;
                }
              }
 else {
                i--;
              }
            }
          }
        }
      }
    }
 else     if (ch == '\u000f') {
      i++;
    }
 else {
      buffer.append(ch);
      i++;
    }
  }
  return buffer.toString();
}

public static String removeColors ( String line ) { int length = line . length ( ) ; StringBuffer buffer = new StringBuffer ( ) ; int i = 0 ; while ( i < length ) { char ch = line . charAt ( i ) ; if ( ch == '' ) { i ++ ; if ( i < length ) { ch = line . charAt ( i ) ; if ( Character . isDigit ( ch ) ) { i ++ ; if ( i < length ) { ch = line . charAt ( i ) ; if ( Character . isDigit ( ch ) ) { i ++ ; } } if ( i < length ) { ch = line . charAt ( i ) ; if ( ch == ',' ) { i ++ ; if ( i < length ) { ch = line . charAt ( i ) ; if ( Character . isDigit ( ch ) ) { i ++ ; if ( i < length ) { ch = line . charAt ( i ) ; if ( Character . isDigit ( ch ) ) { i ++ ; } } } else { i -- ; } } else { i -- ; } } } } } } else if ( ch == '' ) { i ++ ; } else { buffer . append ( ch ) ; i ++ ; } } return buffer . toString ( ) ; }
removes all colours from a line of irc text .
