ComponentPro UltimateTemplateEngine

      ToInt

      Language Filter: AllSend comments on this topic to ComponentPro

      Used to convert object to int. It is similar to explicit conversation.

      ToInt(value)

      Parameter Type Description
      value object value to convert.

      The code below demonstrates how to use it:

      Template.tpl
      {%string str = "10"/}
      
      $ToInt(str)$
      
      $(int)str$

      Output will be:

      10

      10

      using System;
      using System.Collections.Generic;
      using System.Text;
      using ComponentPro;
      
      namespace CSharp
      {
          public class Sample
          {
              [STAThread]
              static void Main()
              {
                  TemplateEngine dt = new TemplateEngine();
                  dt.LoadFromFile("Template.tpl");           
                  string output = dt.Run();
                  Console.WriteLine(output);
              }
          }
      }