新增AnsiColors(改自Spring Boot)、AnsiColorWrapper,优化QrCodeUtil

This commit is contained in:
Looly 2022-09-15 00:07:02 +08:00
parent 15f0b6be54
commit bce8d93ba7
10 changed files with 156 additions and 159 deletions

View File

@ -3,12 +3,13 @@
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.8.7.M1 (2022-09-14) # 5.8.7.M1 (2022-09-15)
### 🐣新特性 ### 🐣新特性
* 【core 】 BooleanUtil的andOfWrap和orOfWrap()忽略nullissue#2599@Github * 【core 】 BooleanUtil的andOfWrap和orOfWrap()忽略nullissue#2599@Github
* 【jwt 】 优化JWT自动识别header中的算法并可自定义header中key的顺序issue#I5QRUO@Gitee * 【jwt 】 优化JWT自动识别header中的算法并可自定义header中key的顺序issue#I5QRUO@Gitee
* 【core 】 IdcardUtil增加convert18To15方法issue#I5QYCP@Gitee * 【core 】 IdcardUtil增加convert18To15方法issue#I5QYCP@Gitee
* 【core 】 新增AnsiColors(改自Spring Boot)、AnsiColorWrapper优化QrCodeUtilpr#778@Gitee
### 🐞Bug修复 ### 🐞Bug修复
* 【core 】 修复ObjectUtil.defaultIfXXX中NPE问题pr#2603@Github * 【core 】 修复ObjectUtil.defaultIfXXX中NPE问题pr#2603@Github

View File

@ -59,6 +59,16 @@ public final class Ansi8BitColor implements AnsiElement {
this.code = code; this.code = code;
} }
/**
* 获取颜色代码(0-255)
*
* @return 颜色代码(0 - 255)
*/
@Override
public int getCode() {
return this.code;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {

View File

@ -1,5 +1,7 @@
package cn.hutool.core.lang.ansi; package cn.hutool.core.lang.ansi;
import cn.hutool.core.util.StrUtil;
/** /**
* ANSI背景颜色枚举 * ANSI背景颜色枚举
* *
@ -13,97 +15,107 @@ public enum AnsiBackground implements AnsiElement {
/** /**
* 默认背景色 * 默认背景色
*/ */
DEFAULT("49"), DEFAULT(49),
/** /**
* 黑色 * 黑色
*/ */
BLACK("40"), BLACK(40),
/** /**
* *
*/ */
RED("41"), RED(41),
/** /**
* 绿 * 绿
*/ */
GREEN("42"), GREEN(42),
/** /**
* *
*/ */
YELLOW("43"), YELLOW(43),
/** /**
* *
*/ */
BLUE("44"), BLUE(44),
/** /**
* 品红 * 品红
*/ */
MAGENTA("45"), MAGENTA(45),
/** /**
* *
*/ */
CYAN("46"), CYAN(46),
/** /**
* *
*/ */
WHITE("47"), WHITE(47),
/** /**
* 亮黑 * 亮黑
*/ */
BRIGHT_BLACK("100"), BRIGHT_BLACK(100),
/** /**
* 亮红 * 亮红
*/ */
BRIGHT_RED("101"), BRIGHT_RED(101),
/** /**
* 亮绿 * 亮绿
*/ */
BRIGHT_GREEN("102"), BRIGHT_GREEN(102),
/** /**
* 亮黄 * 亮黄
*/ */
BRIGHT_YELLOW("103"), BRIGHT_YELLOW(103),
/** /**
* 亮蓝 * 亮蓝
*/ */
BRIGHT_BLUE("104"), BRIGHT_BLUE(104),
/** /**
* 亮品红 * 亮品红
*/ */
BRIGHT_MAGENTA("105"), BRIGHT_MAGENTA(105),
/** /**
* 亮青 * 亮青
*/ */
BRIGHT_CYAN("106"), BRIGHT_CYAN(106),
/** /**
* 亮白 * 亮白
*/ */
BRIGHT_WHITE("107"); BRIGHT_WHITE(107);
private final String code; private final int code;
AnsiBackground(String code) { AnsiBackground(int code) {
this.code = code; this.code = code;
} }
/**
* 获取ANSI颜色代码
*
* @return 颜色代码
*/
@Override
public int getCode() {
return this.code;
}
@Override @Override
public String toString() { public String toString() {
return this.code; return StrUtil.toString(this.code);
} }
} }

View File

@ -1,5 +1,7 @@
package cn.hutool.core.lang.ansi; package cn.hutool.core.lang.ansi;
import cn.hutool.core.util.StrUtil;
/** /**
* ANSI标准颜色 * ANSI标准颜色
* *
@ -13,97 +15,107 @@ public enum AnsiColor implements AnsiElement {
/** /**
* 默认前景色 * 默认前景色
*/ */
DEFAULT("39"), DEFAULT(39),
/** /**
* *
*/ */
BLACK("30"), BLACK(30),
/** /**
* *
*/ */
RED("31"), RED(31),
/** /**
* 绿 * 绿
*/ */
GREEN("32"), GREEN(32),
/** /**
* *
*/ */
YELLOW("33"), YELLOW(33),
/** /**
* *
*/ */
BLUE("34"), BLUE(34),
/** /**
* 品红 * 品红
*/ */
MAGENTA("35"), MAGENTA(35),
/** /**
* *
*/ */
CYAN("36"), CYAN(36),
/** /**
* *
*/ */
WHITE("37"), WHITE(37),
/** /**
* 亮黑 * 亮黑
*/ */
BRIGHT_BLACK("90"), BRIGHT_BLACK(90),
/** /**
* 亮红 * 亮红
*/ */
BRIGHT_RED("91"), BRIGHT_RED(91),
/** /**
* 亮绿 * 亮绿
*/ */
BRIGHT_GREEN("92"), BRIGHT_GREEN(92),
/** /**
* 亮黄 * 亮黄
*/ */
BRIGHT_YELLOW("93"), BRIGHT_YELLOW(93),
/** /**
* 亮蓝 * 亮蓝
*/ */
BRIGHT_BLUE("94"), BRIGHT_BLUE(94),
/** /**
* 亮品红 * 亮品红
*/ */
BRIGHT_MAGENTA("95"), BRIGHT_MAGENTA(95),
/** /**
* 亮青 * 亮青
*/ */
BRIGHT_CYAN("96"), BRIGHT_CYAN(96),
/** /**
* 亮白 * 亮白
*/ */
BRIGHT_WHITE("97"); BRIGHT_WHITE(97);
private final String code; private final int code;
AnsiColor(String code) { AnsiColor(int code) {
this.code = code; this.code = code;
} }
/**
* 获取ANSI颜色代码
*
* @return 颜色代码
*/
@Override
public int getCode() {
return this.code;
}
@Override @Override
public String toString() { public String toString() {
return this.code; return StrUtil.toString(this.code);
} }
} }

View File

@ -18,15 +18,16 @@ public class AnsiColorWrapper {
private final AnsiColors.BitDepth bitDepth; private final AnsiColors.BitDepth bitDepth;
/** /**
* 创建指定位深度的 {@link AnsiColorWrapper} 实例 * 创建指定位深度的 {@code AnsiColorWrapper} 实例
* @param code 颜色编码位深度为4bit时code取值范围[30~37][90~97]位深度为8bit时code取值范围[0~255] *
* @param code 颜色编码位深度为4bit时code取值范围[30~37][90~97]位深度为8bit时code取值范围[0~255]
* @param bitDepth 位深度 * @param bitDepth 位深度
*/ */
public AnsiColorWrapper(int code, AnsiColors.BitDepth bitDepth) { public AnsiColorWrapper(int code, AnsiColors.BitDepth bitDepth) {
if (bitDepth==AnsiColors.BitDepth.FOUR){ if (bitDepth == AnsiColors.BitDepth.FOUR) {
Assert.isTrue((30<=code&&code<=37)||(90<=code&&code<=97),"The value of 4 bit color only supported [30~37],[90~97]."); Assert.isTrue((30 <= code && code <= 37) || (90 <= code && code <= 97), "The value of 4 bit color only supported [30~37],[90~97].");
} }
Assert.isTrue((0<=code&&code<=255),"The value of 8 bit color only supported [0~255]."); Assert.isTrue((0 <= code && code <= 255), "The value of 8 bit color only supported [0~255].");
this.code = code; this.code = code;
this.bitDepth = bitDepth; this.bitDepth = bitDepth;
} }
@ -37,24 +38,24 @@ public class AnsiColorWrapper {
* @param foreOrBack 区分前景还是背景 * @param foreOrBack 区分前景还是背景
* @return {@link AnsiElement} 实例 * @return {@link AnsiElement} 实例
*/ */
public AnsiElement toAnsiElement(ForeOrBack foreOrBack){ public AnsiElement toAnsiElement(ForeOrBack foreOrBack) {
if (bitDepth== AnsiColors.BitDepth.FOUR){ if (bitDepth == AnsiColors.BitDepth.FOUR) {
if (foreOrBack == ForeOrBack.FORE){ if (foreOrBack == ForeOrBack.FORE) {
for (AnsiColor item : AnsiColor.values()) { for (AnsiColor item : AnsiColor.values()) {
if (StrUtil.equals(item.toString(), StrUtil.toString(this.code))) { if (item.getCode() == this.code) {
return item; return item;
} }
} }
throw new IllegalArgumentException(StrUtil.format("No matched AnsiColor instance,code={}",this.code)); throw new IllegalArgumentException(StrUtil.format("No matched AnsiColor instance,code={}", this.code));
} }
for (AnsiBackground item : AnsiBackground.values()) { for (AnsiBackground item : AnsiBackground.values()) {
if (StrUtil.equals(item.toString(), StrUtil.toString(this.code+10))) { if (item.getCode() == this.code + 10) {
return item; return item;
} }
} }
throw new IllegalArgumentException(StrUtil.format("No matched AnsiBackground instance,code={}",this.code)); throw new IllegalArgumentException(StrUtil.format("No matched AnsiBackground instance,code={}", this.code));
} }
if (foreOrBack == ForeOrBack.FORE){ if (foreOrBack == ForeOrBack.FORE) {
return Ansi8BitColor.foreground(this.code); return Ansi8BitColor.foreground(this.code);
} }
return Ansi8BitColor.background(this.code); return Ansi8BitColor.background(this.code);

View File

@ -20,103 +20,28 @@ public final class AnsiColors {
private static final Map<AnsiColorWrapper, LabColor> ANSI_COLOR_MAP; private static final Map<AnsiColorWrapper, LabColor> ANSI_COLOR_MAP;
/**
* @see AnsiColor#BLACK
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BLACK = 30;
/**
* @see AnsiColor#RED
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_RED = 31;
/**
* @see AnsiColor#GREEN
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_GREEN = 32;
/**
* @see AnsiColor#YELLOW
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_YELLOW = 33;
/**
* @see AnsiColor#BLUE
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BLUE = 34;
/**
* @see AnsiColor#MAGENTA
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_MAGENTA = 35;
/**
* @see AnsiColor#CYAN
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_CYAN = 36;
/**
* @see AnsiColor#WHITE
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_WHITE = 37;
/**
* @see AnsiColor#BRIGHT_BLACK
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_BLACK = 90;
/**
* @see AnsiColor#BRIGHT_RED
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_RED = 91;
/**
* @see AnsiColor#BRIGHT_GREEN
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_GREEN = 92;
/**
* @see AnsiColor#BRIGHT_YELLOW
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_YELLOW = 93;
/**
* @see AnsiColor#BRIGHT_BLUE
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_BLUE = 94;
/**
* @see AnsiColor#BRIGHT_MAGENTA
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_MAGENTA = 95;
/**
* @see AnsiColor#BRIGHT_CYAN
*/
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_CYAN = 96;
/** /**
* @see AnsiColor#BRIGHT_WHITE * @see AnsiColor#BRIGHT_WHITE
*/ */
private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_WHITE = 97; private static final int CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_WHITE = 97;
static { static {
Map<AnsiColorWrapper, LabColor> colorMap = new LinkedHashMap<>(16); Map<AnsiColorWrapper, LabColor> colorMap = new LinkedHashMap<>(16, 1);
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BLACK, BitDepth.FOUR), new LabColor(0x000000)); colorMap.put(new AnsiColorWrapper(AnsiColor.BLACK.getCode(), BitDepth.FOUR), new LabColor(0x000000));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_RED, BitDepth.FOUR), new LabColor(0xAA0000)); colorMap.put(new AnsiColorWrapper(AnsiColor.RED.getCode(), BitDepth.FOUR), new LabColor(0xAA0000));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_GREEN, BitDepth.FOUR), new LabColor(0x00AA00)); colorMap.put(new AnsiColorWrapper(AnsiColor.GREEN.getCode(), BitDepth.FOUR), new LabColor(0x00AA00));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_YELLOW, BitDepth.FOUR), new LabColor(0xAA5500)); colorMap.put(new AnsiColorWrapper(AnsiColor.YELLOW.getCode(), BitDepth.FOUR), new LabColor(0xAA5500));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BLUE, BitDepth.FOUR), new LabColor(0x0000AA)); colorMap.put(new AnsiColorWrapper(AnsiColor.BLUE.getCode(), BitDepth.FOUR), new LabColor(0x0000AA));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_MAGENTA, BitDepth.FOUR), new LabColor(0xAA00AA)); colorMap.put(new AnsiColorWrapper(AnsiColor.MAGENTA.getCode(), BitDepth.FOUR), new LabColor(0xAA00AA));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_CYAN, BitDepth.FOUR), new LabColor(0x00AAAA)); colorMap.put(new AnsiColorWrapper(AnsiColor.CYAN.getCode(), BitDepth.FOUR), new LabColor(0x00AAAA));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_WHITE, BitDepth.FOUR), new LabColor(0xAAAAAA)); colorMap.put(new AnsiColorWrapper(AnsiColor.WHITE.getCode(), BitDepth.FOUR), new LabColor(0xAAAAAA));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_BLACK, BitDepth.FOUR), new LabColor(0x555555)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_BLACK.getCode(), BitDepth.FOUR), new LabColor(0x555555));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_RED, BitDepth.FOUR), new LabColor(0xFF5555)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_RED.getCode(), BitDepth.FOUR), new LabColor(0xFF5555));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_GREEN, BitDepth.FOUR), new LabColor(0x55FF00)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_GREEN.getCode(), BitDepth.FOUR), new LabColor(0x55FF00));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_YELLOW, BitDepth.FOUR), new LabColor(0xFFFF55)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_YELLOW.getCode(), BitDepth.FOUR), new LabColor(0xFFFF55));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_BLUE, BitDepth.FOUR), new LabColor(0x5555FF)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_BLUE.getCode(), BitDepth.FOUR), new LabColor(0x5555FF));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_MAGENTA, BitDepth.FOUR), new LabColor(0xFF55FF)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_MAGENTA.getCode(), BitDepth.FOUR), new LabColor(0xFF55FF));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_CYAN, BitDepth.FOUR), new LabColor(0x55FFFF)); colorMap.put(new AnsiColorWrapper(AnsiColor.BRIGHT_CYAN.getCode(), BitDepth.FOUR), new LabColor(0x55FFFF));
colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_WHITE, BitDepth.FOUR), new LabColor(0xFFFFFF)); colorMap.put(new AnsiColorWrapper(CODE_OF_4_BIT_ANSI_COLOR_BRIGHT_WHITE, BitDepth.FOUR), new LabColor(0xFFFFFF));
ANSI_COLOR_MAP = Collections.unmodifiableMap(colorMap); ANSI_COLOR_MAP = Collections.unmodifiableMap(colorMap);
} }
@ -152,7 +77,7 @@ public final class AnsiColors {
private final Map<AnsiColorWrapper, LabColor> lookup; private final Map<AnsiColorWrapper, LabColor> lookup;
/** /**
* 创建具有指定位深度的新 {@link AnsiColors} 实例 * 创建具有指定位深度的新 {@code AnsiColors} 实例
* @param bitDepth 所需的位深度 * @param bitDepth 所需的位深度
*/ */
public AnsiColors(BitDepth bitDepth) { public AnsiColors(BitDepth bitDepth) {
@ -161,7 +86,7 @@ public final class AnsiColors {
private Map<AnsiColorWrapper, LabColor> getLookup(BitDepth bitDepth) { private Map<AnsiColorWrapper, LabColor> getLookup(BitDepth bitDepth) {
if (bitDepth == BitDepth.EIGHT) { if (bitDepth == BitDepth.EIGHT) {
Map<AnsiColorWrapper, LabColor> lookup = new LinkedHashMap<>(256); final Map<AnsiColorWrapper, LabColor> lookup = new LinkedHashMap<>(256, 1);
for (int i = 0; i < ANSI_8BIT_COLOR_CODE_LOOKUP.length; i++) { for (int i = 0; i < ANSI_8BIT_COLOR_CODE_LOOKUP.length; i++) {
lookup.put(new AnsiColorWrapper(i,BitDepth.EIGHT), new LabColor(ANSI_8BIT_COLOR_CODE_LOOKUP[i])); lookup.put(new AnsiColorWrapper(i,BitDepth.EIGHT), new LabColor(ANSI_8BIT_COLOR_CODE_LOOKUP[i]));
} }
@ -239,7 +164,7 @@ public final class AnsiColors {
double deltaA = this.a - other.a; double deltaA = this.a - other.a;
double deltaB = this.b - other.b; double deltaB = this.b - other.b;
double deltaH = Math.sqrt(Math.max(0.0, deltaA * deltaA + deltaB * deltaB - deltaC * deltaC)); double deltaH = Math.sqrt(Math.max(0.0, deltaA * deltaA + deltaB * deltaB - deltaC * deltaC));
return Math.sqrt(Math.max(0.0, Math.pow((this.l - other.l) / (1.0), 2) return Math.sqrt(Math.max(0.0, Math.pow((this.l - other.l), 2)
+ Math.pow(deltaC / (1 + 0.045 * c1), 2) + Math.pow(deltaH / (1 + 0.015 * c1), 2.0))); + Math.pow(deltaC / (1 + 0.045 * c1), 2) + Math.pow(deltaH / (1 + 0.015 * c1), 2.0)));
} }

View File

@ -15,4 +15,12 @@ public interface AnsiElement {
@Override @Override
String toString(); String toString();
/**
* 获取ANSI代码默认返回-1
* @return ANSI代码
* @since 5.8.7
*/
default int getCode(){
return -1;
}
} }

View File

@ -1,5 +1,7 @@
package cn.hutool.core.lang.ansi; package cn.hutool.core.lang.ansi;
import cn.hutool.core.util.StrUtil;
/** /**
* ANSI文本样式风格枚举 * ANSI文本样式风格枚举
* *
@ -13,37 +15,47 @@ public enum AnsiStyle implements AnsiElement {
/** /**
* 重置/正常 * 重置/正常
*/ */
NORMAL("0"), NORMAL(0),
/** /**
* 粗体或增加强度 * 粗体或增加强度
*/ */
BOLD("1"), BOLD(1),
/** /**
* 弱化降低强度 * 弱化降低强度
*/ */
FAINT("2"), FAINT(2),
/** /**
* 斜体 * 斜体
*/ */
ITALIC("3"), ITALIC(3),
/** /**
* 下划线 * 下划线
*/ */
UNDERLINE("4"); UNDERLINE(4);
private final String code; private final int code;
AnsiStyle(String code) { AnsiStyle(int code) {
this.code = code; this.code = code;
} }
/**
* 获取ANSI文本样式风格代码
*
* @return 文本样式风格代码
*/
@Override
public int getCode() {
return this.code;
}
@Override @Override
public String toString() { public String toString() {
return this.code; return StrUtil.toString(this.code);
} }
} }

View File

@ -0,0 +1,17 @@
package cn.hutool.core.convert;
import cn.hutool.core.util.NumberUtil;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigDecimal;
public class Issue2611Test {
@Test
public void chineseMoneyToNumberTest(){
final BigDecimal value = Convert.chineseMoneyToNumber("陆万柒仟伍佰伍拾柒元");
Assert.assertEquals("67,557.00", NumberUtil.decimalFormatMoney(value.doubleValue()));
}
}

View File

@ -1,12 +1,11 @@
package cn.hutool.core.lang.ansi; package cn.hutool.core.lang.ansi;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.awt.*; import java.awt.Color;
public class AnsiEncoderTest { public class AnsiEncoderTest {
@ -36,7 +35,7 @@ public class AnsiEncoderTest {
Color backColor = new Color(255 - foreColor.getRed(), 255 - foreColor.getGreen(), 255 - foreColor.getBlue()); Color backColor = new Color(255 - foreColor.getRed(), 255 - foreColor.getGreen(), 255 - foreColor.getBlue());
AnsiElement backElement = ansiColors.findClosest(backColor).toAnsiElement(ForeOrBack.BACK); AnsiElement backElement = ansiColors.findClosest(backColor).toAnsiElement(ForeOrBack.BACK);
String encode = AnsiEncoder.encode(foreElement, backElement, text); String encode = AnsiEncoder.encode(foreElement, backElement, text);
//Console.print( i%2==1?encode+"\n":encode); Console.print( i%2==1?encode+"\n":encode);
} }
} }