FileDocCategorySizeDatePackage
Detab.javaAPI DocExample894Sat Nov 25 12:56:14 GMT 2000None

Detab

public class Detab extends Tabs
detab- replace blanks by tabs and blanks.
author
Ian F. Darwin, ian@darwinsys.com
version
$Id: Detab.java,v 1.2 2000/11/25 17:56:14 ian Exp $

Fields Summary
Constructors Summary
public Detab(int n)

		super(n);
	
Methods Summary
public voiddetab(java.io.BufferedReader is)

		String line;
		char c;
		int col;
		while ((line = is.readLine()) != null) {
			col = 0;
			for (int i=0; i<line.length(); i++) {
				// Either ordinary character or tab.
				if ((c=line.charAt(i)) != '\t") {
					System.out.print(c); // Ordinary
					++col;
					continue;
				}
				do { // Tab, expand it, must put >=1 space
					System.out.print(' ");
				} while (!tabpos(++col));
			}
			System.out.println();
		}
	
public static voidmain(java.lang.String[] argv)

		Detab dt = new Detab(8);
		dt.detab(new BufferedReader(new InputStreamReader(System.in)));