Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
import java.util.function.IntPredicate;
|
||||
|
||||
public class StripControlCodes {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = "\u0000\n abc\u00E9def\u007F";
|
||||
System.out.println(stripChars(s, c -> c > '\u001F' && c != '\u007F'));
|
||||
System.out.println(stripChars(s, c -> c > '\u001F' && c < '\u007F'));
|
||||
}
|
||||
|
||||
static String stripChars(String s, IntPredicate include) {
|
||||
return s.codePoints().filter(include::test).collect(StringBuilder::new,
|
||||
StringBuilder::appendCodePoint, StringBuilder::append).toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue