title: Drupal8 Twig - convert string to integer
body: <p>I just started using twig in drupal8. I'm trying to calculate the difference between two numerical drupal8 variables using views.</p>
  
  <pre><code>field_goals_for: 24
  field_goals_against: 3
  field_goals_difference: should return 21 but returns 1
  </code></pre>
  
  <p>I tried already something like this (with and without number_formats):</p>
  
  <pre><code>{% set diff = field_goals_for|number_format - field_goals_against|number_format %}
  {{ diff }}
  </code></pre>
  
  <p>I assume the problem is that the two variables are strings instead of int.</p>
  
  <p>There is a way to convert them to int and return the correct result using twig? If not do you have any alternative solution to suggest?</p>
  
  <p>EDIT:
  I tried to SUM and also MULTIPLE the two values:</p>
  
  <pre><code>{{ field_goals_for }} = 24
  {{ field_goals_against }} = 3
  {{ field_goals_for - field_goals_against }} = 0
  {{ field_goals_for + field_goals_against }} = 2
  {{ field_goals_for * field_goals_against }} = 1
  </code></pre>
  
  <p>Why are they considered equal to 1 instead of their real value?</p>
  
  <p>EDIT 2: I found the problem. The value that has been to used is field_goals_for__value instead of field_goals_for. Unfortunately I can't find a way to used both of them in the same text field.</p>