@@ -590,25 +590,25 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
590590 }
591591 }
592592
593- internal class Function_INDEXOF : Function_N
593+ internal class Function_INDEXOF : Function_4
594594 {
595- public Function_INDEXOF ( FunctionBase [ ] funcs ) : base ( funcs )
595+ public Function_INDEXOF ( FunctionBase func1 , FunctionBase func2 , FunctionBase func3 , FunctionBase func4 ) : base ( func1 , func2 , func3 , func4 )
596596 {
597597 }
598598
599599 public override Operand Calculate ( AlgorithmEngine work )
600600 {
601- var args1 = funcs [ 0 ] . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
602- var args2 = funcs [ 1 ] . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
601+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
602+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
603603 var text = args1 . TextValue ;
604- if ( funcs . Length == 2 ) {
604+ if ( func3 == null ) {
605605 return Operand . Create ( text . AsSpan ( ) . IndexOf ( args2 . TextValue ) + work . ExcelIndex ) ;
606606 }
607- var args3 = funcs [ 2 ] . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
608- if ( funcs . Length == 3 ) {
607+ var args3 = func3 . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
608+ if ( func4 == null ) {
609609 return Operand . Create ( text . AsSpan ( args3 . IntValue ) . IndexOf ( args2 . TextValue ) + args3 . IntValue + work . ExcelIndex ) ;
610610 }
611- var args4 = funcs [ 3 ] . Calculate ( work ) ; if ( args4 . Type != OperandType . NUMBER ) { args4 = args4 . ToNumber ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 4 ) ; if ( args4 . IsError ) { return args4 ; } }
611+ var args4 = func4 . Calculate ( work ) ; if ( args4 . Type != OperandType . NUMBER ) { args4 = args4 . ToNumber ( "Function '{0}' parameter {1} is error!" , "IndexOf" , 4 ) ; if ( args4 . IsError ) { return args4 ; } }
612612 return Operand . Create ( text . IndexOf ( args2 . TextValue , args3 . IntValue , args4 . IntValue ) + work . ExcelIndex ) ;
613613 }
614614 public override void ToString ( StringBuilder stringBuilder , bool addBrackets )
@@ -617,25 +617,25 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
617617 }
618618 }
619619
620- internal class Function_LASTINDEXOF : Function_N
620+ internal class Function_LASTINDEXOF : Function_4
621621 {
622- public Function_LASTINDEXOF ( FunctionBase [ ] funcs ) : base ( funcs )
622+ public Function_LASTINDEXOF ( FunctionBase func1 , FunctionBase func2 , FunctionBase func3 , FunctionBase func4 ) : base ( func1 , func2 , func3 , func4 )
623623 {
624624 }
625625
626626 public override Operand Calculate ( AlgorithmEngine work )
627627 {
628- var args1 = funcs [ 0 ] . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
629- var args2 = funcs [ 1 ] . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
628+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
629+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
630630 var text = args1 . TextValue ;
631- if ( funcs . Length == 2 ) {
631+ if ( func3 == null ) {
632632 return Operand . Create ( text . AsSpan ( ) . LastIndexOf ( args2 . TextValue ) + work . ExcelIndex ) ;
633633 }
634- var args3 = funcs [ 2 ] . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
635- if ( funcs . Length == 3 ) {
634+ var args3 = func3 . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
635+ if ( func4 == null ) {
636636 return Operand . Create ( text . AsSpan ( 0 , args3 . IntValue ) . LastIndexOf ( args2 . TextValue ) + work . ExcelIndex ) ;
637637 }
638- var args4 = funcs [ 3 ] . Calculate ( work ) ; if ( args4 . Type != OperandType . NUMBER ) { args4 = args4 . ToNumber ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 4 ) ; if ( args4 . IsError ) { return args4 ; } }
638+ var args4 = func4 . Calculate ( work ) ; if ( args4 . Type != OperandType . NUMBER ) { args4 = args4 . ToNumber ( "Function '{0}' parameter {1} is error!" , "LastIndexOf" , 4 ) ; if ( args4 . IsError ) { return args4 ; } }
639639 return Operand . Create ( text . LastIndexOf ( args2 . TextValue , args3 . IntValue , args4 . IntValue ) + work . ExcelIndex ) ;
640640 }
641641 public override void ToString ( StringBuilder stringBuilder , bool addBrackets )
0 commit comments