Created
December 13, 2011 19:12
-
-
Save msalvadores/1473419 to your computer and use it in GitHub Desktop.
fast filtered output test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.io.PrintStream; | |
public class TestOutput { | |
public static void outputFiltered(String label, PrintStream out) { | |
for (byte b : label.getBytes()) { | |
if (Character.isLetterOrDigit((char)b)) { | |
out.print((char)b); | |
} | |
} | |
} | |
public static void main(String[] args) { | |
String label = "abcd. 12345 !@#$ abcd"; | |
outputFiltered(label,System.out); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment