title: How do I pass a String into a function in an NVelocity Template?
body: <p>I'm using the <strong><a href="http://nvelocity.sourceforge.net/" rel="nofollow noreferrer">NVelocity Templating engine</a></strong> to produce a <strong>fixed-length</strong> field output - you know the kind of thing:</p>
  
  <pre><code>Field        Start Pos   Field Length  Notes
  ----------   ---------   ------------  ---------
  Supplier      1           7            Leading Zeros
  GRN           8           9            -
  ...
  
  e.g.
  &gt;0001234    123A&lt;
  </code></pre>
  
  <p>The problem is <strong>I'm trying to call String.PadRight() with the overload to specify the leading zero, and NVelocity is having none of it..</strong></p>
  
  <p><strong>This works:</strong></p>
  
  <pre><code>$Document.SupplierCode.PadRight(7)
  </code></pre>
  
  <p><strong>But this doesn't:</strong></p>
  
  <pre><code>$Document.SupplierCode.PadRight(7,"0")
  </code></pre>
  
  <p><strong>I've tried:</strong></p>
  
  <ul>
  <li><p>Single Quotes (<code>'0'</code>)</p></li>
  <li><p>Double Single-Quotes (<code>''0''</code>)</p></li>
  <li><p>Double Quotes (<code>"0"</code>)</p></li>
  <li><p>Double Double-Quotes (<code>""0""</code>)</p></li>
  <li><p>Escaping the quotes for all of the above (<code>\"0\"</code>)</p></li>
  <li><p>No Quotes!</p></li>
  </ul>
  
  <p>All I've found to work from is the <a href="http://nvelocity.sourceforge.net/" rel="nofollow noreferrer">NVelocity Homepage</a>, and the <a href="http://velocity.apache.org/engine/releases/velocity-1.5/vtl-reference-guide.html" rel="nofollow noreferrer">Velocity Templating Language Reference page</a>, niether are pointing me at a solution.</p>
  
  <p>Sorry I'm unable to supply or point you somewhere where you can test out your ideas for yourself, but any suggestions you may have will be most welcome!</p>
  
  <p>Thanks for your help  ;o)</p>