From 103d92b61014b24dbd123e826938c393387dd71f Mon Sep 17 00:00:00 2001 From: cjl_macbook Date: Sat, 11 Aug 2018 21:22:16 +0800 Subject: [PATCH] delete some print and update comment --- lib/generator.dart | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/generator.dart b/lib/generator.dart index 3e1ecbf..b8993ca 100644 --- a/lib/generator.dart +++ b/lib/generator.dart @@ -82,6 +82,7 @@ String camelCase2UnderScoreCase(String name) { }); } +/// use the string replace's method the resolve the int and double problem. String convertJsonString(String jsonString) { var numberReg = RegExp(r"[0-9]\.[0-9]+"); @@ -93,16 +94,7 @@ String convertJsonString(String jsonString) { var m = allMatch[i]; var s = m.group(0); - // if (double.tryParse(s) is double) { - // // 说明是真实的小数 - // // 这里直接匹配下一个 - // print("$s is double"); - // continue; - // } - - // print("$s is int"); - - // 应该是double,但由于js的原因被识别成了整数数,这里对这种数据进行处理,将这里的最后一位从0替换为1 + // 应该是double,但由于js的原因被识别成了整数数,这里对这种数据进行处理,将这里的最后一位从0替换为5,以便于让该被js识别成小数 而非数字 s = s.replaceRange(s.length - 1, s.length, "5"); jsonString = jsonString.replaceRange(m.start, m.end, s); }