public static String expandLine(CharSequence self,int tabStop){
  String s=self.toString();
  int index;
  while ((index=s.indexOf('\t')) != -1) {
    StringBuilder builder=new StringBuilder(s);
    int count=tabStop - index % tabStop;
    builder.deleteCharAt(index);
    for (int i=0; i < count; i++)     builder.insert(index," ");
    s=builder.toString();
  }
  return s;
}

public static String expandLine ( CharSequence self , int tabStop ) { String s = self . toString ( ) ; int index ; while ( ( index = s . indexOf ( '\t' ) ) != - 1 ) { StringBuilder builder = new StringBuilder ( s ) ; int count = tabStop - index % tabStop ; builder . deleteCharAt ( index ) ; for ( int i = 0 ; i < count ; i ++ ) builder . insert ( index , " " ) ; s = builder . toString ( ) ; } return s ; }
expands all tabs into spaces . assumes the charsequence represents a single line of text .
