@@ -57,7 +57,7 @@ public virtual Operand VisitMulDiv_fun(mathParser.MulDiv_funContext context)
5757 if ( a . IsError == false ) secondValue = a ;
5858 }
5959 }
60- if ( CharUtil . Equals ( t , "*" ) ) {
60+ if ( CharUtil . Equals ( t , '*' ) ) {
6161 if ( secondValue . Type == OperandType . BOOLEAN ) {
6262 if ( secondValue . BooleanValue )
6363 return firstValue ;
@@ -85,7 +85,7 @@ public virtual Operand VisitMulDiv_fun(mathParser.MulDiv_funContext context)
8585 secondValue = secondValue . ToNumber ( $ "Function '{ t } ' parameter 2 is error!") ;
8686 if ( secondValue . IsError ) { return secondValue ; }
8787 return Operand . Create ( firstValue . NumberValue * secondValue . NumberValue ) ;
88- } else if ( CharUtil . Equals ( t , "/" ) ) {
88+ } else if ( CharUtil . Equals ( t , '/' ) ) {
8989 if ( firstValue . Type == OperandType . DATE ) {
9090 return Operand . Create ( firstValue . DateValue / secondValue . NumberValue ) ;
9191 }
@@ -98,7 +98,7 @@ public virtual Operand VisitMulDiv_fun(mathParser.MulDiv_funContext context)
9898 return Operand . Error ( $ "Function '{ t } ' parameter 2 is error!") ;
9999 }
100100 return Operand . Create ( firstValue . NumberValue / secondValue . NumberValue ) ;
101- } else if ( CharUtil . Equals ( t , "%" ) ) {
101+ } else if ( CharUtil . Equals ( t , '%' ) ) {
102102 firstValue = firstValue . ToNumber ( "% fun right value" ) ;
103103 if ( firstValue . IsError ) { return firstValue ; }
104104 secondValue = secondValue . ToNumber ( "% fun right value" ) ;
@@ -120,7 +120,7 @@ public virtual Operand VisitAddSub_fun(mathParser.AddSub_funContext context)
120120 var secondValue = args [ 1 ] ;
121121 var t = context . op . Text ;
122122
123- if ( CharUtil . Equals ( t , "&" ) ) {
123+ if ( CharUtil . Equals ( t , '&' ) ) {
124124 if ( firstValue . IsNull && secondValue . IsNull ) {
125125 return firstValue ;
126126 } else if ( firstValue . IsNull ) {
@@ -155,7 +155,7 @@ public virtual Operand VisitAddSub_fun(mathParser.AddSub_funContext context)
155155 if ( a . IsError == false ) secondValue = a ;
156156 }
157157 }
158- if ( CharUtil . Equals ( t , "+" ) ) {
158+ if ( CharUtil . Equals ( t , '+' ) ) {
159159 if ( firstValue . Type == OperandType . DATE && secondValue . Type == OperandType . DATE ) {
160160 return Operand . Create ( firstValue . DateValue + secondValue . DateValue ) ;
161161 } else if ( firstValue . Type == OperandType . DATE ) {
@@ -172,7 +172,7 @@ public virtual Operand VisitAddSub_fun(mathParser.AddSub_funContext context)
172172 secondValue = secondValue . ToNumber ( $ "Function '{ t } ' parameter 2 is error!") ;
173173 if ( secondValue . IsError ) { return secondValue ; }
174174 return Operand . Create ( firstValue . NumberValue + secondValue . NumberValue ) ;
175- } else if ( CharUtil . Equals ( t , "-" ) ) {
175+ } else if ( CharUtil . Equals ( t , '-' ) ) {
176176 if ( firstValue . Type == OperandType . DATE && secondValue . Type == OperandType . DATE ) {
177177 return Operand . Create ( firstValue . DateValue - secondValue . DateValue ) ;
178178 } else if ( firstValue . Type == OperandType . DATE ) {
@@ -182,7 +182,7 @@ public virtual Operand VisitAddSub_fun(mathParser.AddSub_funContext context)
182182 } else if ( secondValue . Type == OperandType . DATE ) {
183183 firstValue = firstValue . ToNumber ( $ "Function '{ t } ' parameter 1 is error!") ;
184184 if ( firstValue . IsError ) { return firstValue ; }
185- return Operand . Create ( secondValue . DateValue - firstValue . NumberValue ) ;
185+ return Operand . Create ( firstValue . NumberValue - secondValue . DateValue ) ;
186186 }
187187 firstValue = firstValue . ToNumber ( null ) ;
188188 if ( firstValue . IsError ) { return firstValue ; }
@@ -263,11 +263,11 @@ public virtual Operand VisitJudge_fun(mathParser.Judge_funContext context)
263263
264264 r = Compare ( firstValue . NumberValue , secondValue . NumberValue ) ;
265265 }
266- if ( CharUtil . Equals ( type , "<" ) ) {
266+ if ( CharUtil . Equals ( type , '<' ) ) {
267267 return Operand . Create ( r == - 1 ) ;
268268 } else if ( CharUtil . Equals ( type , "<=" ) ) {
269269 return Operand . Create ( r <= 0 ) ;
270- } else if ( CharUtil . Equals ( type , ">" ) ) {
270+ } else if ( CharUtil . Equals ( type , '>' ) ) {
271271 return Operand . Create ( r == 1 ) ;
272272 } else if ( CharUtil . Equals ( type , ">=" ) ) {
273273 return Operand . Create ( r >= 0 ) ;
@@ -815,7 +815,7 @@ public virtual Operand VisitFIXED_fun(mathParser.FIXED_funContext context)
815815 no = thirdValue . BooleanValue ;
816816 }
817817 if ( no == false ) {
818- return Operand . Create ( s . ToString ( "N" + num , cultureInfo ) ) ;
818+ return Operand . Create ( s . ToString ( 'N' + num . ToString ( ) , cultureInfo ) ) ;
819819 }
820820 return Operand . Create ( s . ToString ( cultureInfo ) ) ;
821821 }
@@ -1898,7 +1898,7 @@ public virtual Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
18981898 var endMyDate = ( DateTime ) secondValue . DateValue ;
18991899 var t = thirdValue . TextValue . ToLower ( ) ;
19001900
1901- if ( CharUtil . Equals ( t , "y" ) ) {
1901+ if ( CharUtil . Equals ( t , 'Y' ) ) {
19021902 #region y
19031903 bool b = false ;
19041904 if ( startMyDate . Month < endMyDate . Month ) {
@@ -1912,7 +1912,7 @@ public virtual Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19121912 return Operand . Create ( ( endMyDate . Year - startMyDate . Year - 1 ) ) ;
19131913 }
19141914 #endregion
1915- } else if ( CharUtil . Equals ( t , "m" ) ) {
1915+ } else if ( CharUtil . Equals ( t , 'M' ) ) {
19161916 #region m
19171917 bool b = false ;
19181918 if ( startMyDate . Day <= endMyDate . Day ) b = true ;
@@ -1922,9 +1922,9 @@ public virtual Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19221922 return Operand . Create ( ( endMyDate . Year * 12 + endMyDate . Month - startMyDate . Year * 12 - startMyDate . Month - 1 ) ) ;
19231923 }
19241924 #endregion
1925- } else if ( CharUtil . Equals ( t , "d" ) ) {
1925+ } else if ( CharUtil . Equals ( t , 'D' ) ) {
19261926 return Operand . Create ( ( endMyDate - startMyDate ) . Days ) ;
1927- } else if ( CharUtil . Equals ( t , "yd " ) ) {
1927+ } else if ( CharUtil . Equals ( t , "YD " ) ) {
19281928 #region yd
19291929 var day = endMyDate . DayOfYear - startMyDate . DayOfYear ;
19301930 if ( endMyDate . Year > startMyDate . Year && day < 0 ) {
@@ -1933,7 +1933,7 @@ public virtual Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19331933 }
19341934 return Operand . Create ( ( day ) ) ;
19351935 #endregion
1936- } else if ( CharUtil . Equals ( t , "md " ) ) {
1936+ } else if ( CharUtil . Equals ( t , "MD " ) ) {
19371937 #region md
19381938 var mo = endMyDate . Day - startMyDate . Day ;
19391939 if ( mo < 0 ) {
@@ -1948,7 +1948,7 @@ public virtual Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19481948 }
19491949 return Operand . Create ( ( mo ) ) ;
19501950 #endregion
1951- } else if ( CharUtil . Equals ( t , "ym " ) ) {
1951+ } else if ( CharUtil . Equals ( t , "YM " ) ) {
19521952 #region ym
19531953 var mo = endMyDate . Month - startMyDate . Month ;
19541954 if ( endMyDate . Day < startMyDate . Day ) mo = mo - 1 ;
@@ -2317,7 +2317,7 @@ public virtual Operand VisitAVERAGEIF_fun(mathParser.AVERAGEIF_funContext contex
23172317 } else {
23182318 if ( double . TryParse ( args [ 1 ] . TextValue . Trim ( ) , NumberStyles . Any , cultureInfo , out double d ) ) {
23192319 count = F_base_countif ( list , d ) ;
2320- sum = F_base_sumif ( list , "=" + args [ 1 ] . TextValue . Trim ( ) , sumdbs ) ;
2320+ sum = F_base_sumif ( list , '=' + args [ 1 ] . TextValue . Trim ( ) , sumdbs ) ;
23212321 } else {
23222322 var sunif = args [ 1 ] . TextValue . Trim ( ) ;
23232323 if ( sumifRegex . IsMatch ( sunif ) ) {
@@ -2441,7 +2441,7 @@ public virtual Operand VisitSUMIF_fun(mathParser.SUMIF_funContext context)
24412441 sum = F_base_countif ( list , args [ 1 ] . NumberValue ) * args [ 1 ] . NumberValue ;
24422442 } else {
24432443 if ( double . TryParse ( args [ 1 ] . TextValue . Trim ( ) , NumberStyles . Any , cultureInfo , out _ ) ) {
2444- sum = F_base_sumif ( list , "=" + args [ 1 ] . TextValue . Trim ( ) , sumdbs ) ;
2444+ sum = F_base_sumif ( list , '=' + args [ 1 ] . TextValue . Trim ( ) , sumdbs ) ;
24452445 } else {
24462446 var sunif = args [ 1 ] . TextValue . Trim ( ) ;
24472447 if ( sumifRegex . IsMatch ( sunif ) ) {
@@ -2923,11 +2923,11 @@ private double F_base_sumif(List<double> dbs, string s, List<double> sumdbs)
29232923 }
29242924 private bool F_base_compare ( double a , double b , string ss )
29252925 {
2926- if ( CharUtil . Equals ( ss , "<" ) ) {
2926+ if ( CharUtil . Equals ( ss , '<' ) ) {
29272927 return Math . Round ( a - b , 12 , MidpointRounding . AwayFromZero ) < 0 ;
29282928 } else if ( CharUtil . Equals ( ss , "<=" ) ) {
29292929 return Math . Round ( a - b , 12 , MidpointRounding . AwayFromZero ) <= 0 ;
2930- } else if ( CharUtil . Equals ( ss , ">" ) ) {
2930+ } else if ( CharUtil . Equals ( ss , '>' ) ) {
29312931 return Math . Round ( a - b , 12 , MidpointRounding . AwayFromZero ) > 0 ;
29322932 } else if ( CharUtil . Equals ( ss , ">=" ) ) {
29332933 return Math . Round ( a - b , 12 , MidpointRounding . AwayFromZero ) >= 0 ;
@@ -3603,7 +3603,7 @@ public virtual Operand VisitJSON_fun(mathParser.JSON_funContext context)
36033603 var firstValue = this . Visit ( context . expr ( ) ) . ToText ( "Function JSON parameter is error!" ) ;
36043604 if ( firstValue . IsError ) { return firstValue ; }
36053605 var txt = firstValue . TextValue ;
3606- if ( ( txt . StartsWith ( "{" ) && txt . EndsWith ( "}" ) ) || ( txt . StartsWith ( "[" ) && txt . EndsWith ( "]" ) ) ) {
3606+ if ( ( txt . StartsWith ( '{' ) && txt . EndsWith ( '}' ) ) || ( txt . StartsWith ( '[' ) && txt . EndsWith ( ']' ) ) ) {
36073607 try {
36083608 var json = JsonMapper . ToObject ( txt ) ;
36093609 return Operand . Create ( json ) ;
@@ -3802,7 +3802,7 @@ public virtual Operand VisitPARAMETER_fun(mathParser.PARAMETER_funContext contex
38023802 node = context . PARAMETER2 ( ) ;
38033803 if ( node != null ) {
38043804 string str = node . GetText ( ) ;
3805- if ( str . StartsWith ( "@" ) ) {
3805+ if ( str . StartsWith ( '@' ) ) {
38063806 return GetParameter ( str . Substring ( 1 ) ) ;
38073807 }
38083808 return GetParameter ( str . Substring ( 1 , str . Length - 2 ) ) ;
0 commit comments