title: How can I convert a string to a number in xpath to run a calculation against it?
body: <p><strong>The Goal</strong>
  I'm trying to: </p>
  
  <p>1) scrape all instances of price on a page; </p>
  
  <p>2) find the count of prices to get the count of products on a page; 3) calculate the average price. </p>
  
  <p><strong>Why I'm Doing This</strong>
  I want to drop the <code>xpath</code> expression into Screaming Frog to extract the count and avg into separate columns when I crawl the site.</p>
  
  <p><strong>Where I'm Stuck</strong>
  I can't calculate the avg b/c the prices are strings, not integers.</p>
  
  <p><strong>Contrived Ex</strong>
  Since I can't share my real ex, I've replicated the issue with a scrape of this Hipmunk query: <code>https://www.hipmunk.com/flights#f=NYC;t=SEA;d=2019-11-08;r=2019-11-10;is_search_for_business=false.</code></p>
  
  <p>The xpath I'm using to grab the prices: <code>//div[@class = 'FlightPrice']</code></p>
  
  <p>You can see from the Results pane in the screenshot below, it works swimmingly.</p>
  
  <p><a href="https://i.stack.imgur.com/8DFKf.png" rel="nofollow noreferrer">screenshot of functional xpath</a></p>
  
  <p>Is it possible to convert the currency strings to an integer so I can run calculations on them? I tried wrapping it in a number() function but just got an <code>NaN error</code>. Not sure if it's because of the $s.</p>