title: Sort an Array of Strings by their Integer Values
body: <p>Let's say I have an unsorted array from 1 to 10, as shown below...</p>
  <pre><code>a = [&quot;3&quot;, &quot;5&quot;, &quot;8&quot;, &quot;4&quot;, &quot;1&quot;, &quot;2&quot;, &quot;9&quot;, &quot;10&quot;, &quot;7&quot;, &quot;6&quot;]
  </code></pre>
  <p>If I use the sort method on this array, it returns this...</p>
  <pre><code>a.sort = [&quot;1&quot;, &quot;10&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;]
  </code></pre>
  <p>As you can see, the 10, appears before the 2, which is incorrect. How can I sort these numbers so that 10 appears correctly?</p>
  <p>EDIT: Thank you all for your responses. I should explain my problem a little better. The array I need sorted is for an e-commerce price list. So the array appears as follows...</p>
  <pre><code>a = [&quot;0-10&quot;, &quot;11-20&quot;, &quot;21-30&quot;, &quot;31-40&quot; etc.]
  </code></pre>
  <p>So the strings cannot be converted to integers. I should have put this when I wrote the question. I did not think that there would be much difference in the fix. My mistake, I apologise for making this assumption! How though can I sort this array? Thanks!</p>