| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using IwbZero.Expr;
- namespace IwbZero.ExprFunctions.Functions
- {
- /// <summary>
- /// Format字符串
- /// </summary>
- public class FunFormatStr:IIwbFunction
- {
- public string Invoke(ExprObject exprObj)
- {
- string text = "";
- ExprObject child = exprObj.GetChild(0);
- if (child != null)
- {
- text = child.Expr;
- if (exprObj.ChildCount > 1)
- {
- object[] array = new object[exprObj.ChildCount / 2];
- for (int i = 2; i < exprObj.ChildCount; i++)
- {
- if (i % 2 == 0)
- {
- int num = i / 2 - 1;
- array[num] = exprObj.GetChild(i).Expr;
- }
-
- //int num = i / 2 - 1;
- //if ((num + 1) * 2 == i)
- //{
- // array[num] = exprObj.GetChild(i).Expr;
- //}
-
- }
- text = string.Format(text, array);
- }
- }
- return text;
- }
- }
- }
|