Added AnsiEscapeCodeSequence.strip() to get the undecorated string.
This commit is contained in:
parent
bbef072f8b
commit
4b3c20a913
@ -14,7 +14,7 @@ apply plugin: "ch.raffael.pegdown-doclet"
|
||||
apply plugin: "maven"
|
||||
|
||||
group = "com.jdbernard"
|
||||
version = "4.3"
|
||||
version = "4.4"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
@ -6,6 +6,8 @@
|
||||
*/
|
||||
package com.jdbernard.util;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* The AnsiEscapeCodeSequence class is an extended wrapper around
|
||||
* [ANSI escape codes].
|
||||
@ -14,15 +16,21 @@ package com.jdbernard.util;
|
||||
*/
|
||||
public class AnsiEscapeCodeSequence {
|
||||
|
||||
public StringBuilder value = new StringBuilder();
|
||||
|
||||
public static final String CSI = "\u001b[";
|
||||
|
||||
public static final Pattern ANSI_SEQ_PATTERN =
|
||||
Pattern.compile("\u001b\\[[^a-zA-Z]+[a-zA-Z]");
|
||||
|
||||
public static enum Colors {
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, EXT, DEFAULT }
|
||||
|
||||
public static enum Erase { ToEnd, ToBeginning, All }
|
||||
|
||||
public static String strip(String input) {
|
||||
return ANSI_SEQ_PATTERN.matcher(input).replaceAll(""); }
|
||||
|
||||
public StringBuilder value = new StringBuilder();
|
||||
|
||||
public String toString() { return value.toString(); }
|
||||
|
||||
// Multiple methods for various forms of SGR
|
||||
|
Loading…
Reference in New Issue
Block a user