Skip to content

Commit b5ef3f6

Browse files
author
linzhijun
committed
fix json()
1 parent 906cab3 commit b5ef3f6

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

java/toolgood.algorithm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.toolgood</groupId>
88
<artifactId>toolgood-algorithm</artifactId>
9-
<version>3.5.0.1</version>
9+
<version>3.5.0.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>toolgood.algorithm</name>

java/toolgood.algorithm/src/main/java/toolgood/algorithm/internals/MathVisitor.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,9 +2277,9 @@ private String F_base_ToDBC(final String input) {
22772277
return sb.toString();
22782278
}
22792279

2280-
static final String[] CN_UPPER_NUMBER = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
2281-
static final String[] CN_UPPER_MONETRAY_UNIT = { "分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰",
2282-
"仟", "兆", "拾", "佰", "仟" };
2280+
static final String[] CN_UPPER_NUMBER = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
2281+
static final String[] CN_UPPER_MONETRAY_UNIT = {"分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰",
2282+
"仟", "兆", "拾", "佰", "仟"};
22832283
static final String CN_FULL = "整";
22842284
static final String CN_NEGATIVE = "负";
22852285
static final int MONEY_PRECISION = 2;
@@ -4926,7 +4926,7 @@ public Operand visitTRIMSTART_fun(final TRIMSTART_funContext context) {
49264926
String text = args.get(0).TextValue();
49274927
if (args.size() == 2) {
49284928
text = Pattern.compile(
4929-
"^[" + args.get(1).TextValue().replace("[", "\\[").replace("]", "\\]").replace("\\", "\\\\") + "]*")
4929+
"^[" + args.get(1).TextValue().replace("[", "\\[").replace("]", "\\]").replace("\\", "\\\\") + "]*")
49304930
.matcher(text).replaceAll("");
49314931
return Operand.Create(text);
49324932
}
@@ -4948,7 +4948,7 @@ public Operand visitTRIMEND_fun(final TRIMEND_funContext context) {
49484948
String text = args.get(0).TextValue();
49494949
if (args.size() == 2) {
49504950
text = Pattern.compile(
4951-
"[" + args.get(1).TextValue().replace("[", "\\[").replace("]", "\\]").replace("\\", "\\\\") + "]*$")
4951+
"[" + args.get(1).TextValue().replace("[", "\\[").replace("]", "\\]").replace("\\", "\\\\") + "]*$")
49524952
.matcher(text).replaceAll("");
49534953
return Operand.Create(text);
49544954
}
@@ -5296,7 +5296,11 @@ public Operand visitREMOVEEND_fun(final REMOVEEND_funContext context) {
52965296
}
52975297

52985298
public Operand visitJSON_fun(final JSON_funContext context) {
5299-
final Operand firstValue = context.expr().accept(this).ToText("Function JSON parameter is error!");
5299+
Operand firstValue = context.expr().accept(this);
5300+
if (firstValue.Type() == OperandType.JSON) {
5301+
return firstValue;
5302+
}
5303+
firstValue = firstValue.ToText("Function JSON parameter is error!");
53005304
if (firstValue.IsError()) {
53015305
return firstValue;
53025306
}
@@ -5733,8 +5737,8 @@ else if (c2 == 't')
57335737
sb.append('\t');
57345738
else if (c2 == '0')
57355739
sb.append('\0');
5736-
// else if (c2 == 'v') sb.append('\v');
5737-
// else if (c2 == 'a') sb.append('\a');
5740+
// else if (c2 == 'v') sb.append('\v');
5741+
// else if (c2 == 'a') sb.append('\a');
57385742
else if (c2 == 'b')
57395743
sb.append('\b');
57405744
else if (c2 == 'f')

0 commit comments

Comments
 (0)