title: Swift native functions to have numbers as hex strings
body: <p>Is there any native Swift way for any (at least integer) number to get its hexadecimal representation in a string? And the inverse. It must not use Foundation. For example the String class has a function</p>
  
  <pre><code>func toInt() -&gt; Int?
  </code></pre>
  
  <p>which converts a string representing an integer to its Int value. I am looking for something similar, using the hex strings. I know this is easily implementable, but if Swift has it there already it would be better. Otherwise if you made already an extension of String and Int to achieve the following:</p>
  
  <pre><code>let anHex = "0xA0"
  if let anInt = anHex.toInt() {
     println(anInt)               // prints 128
     println(anInt.toHexString()) // prints "0xA0"
  }
  </code></pre>
  
  <p>I know it isn't rocket science but in case please share it. </p>
  
  <p>PS: This is similar to <a href="https://stackoverflow.com/q/24229505/4243998">this question</a>, the difference is that it was very related to the Foundation framework, while I am not using it in my code (nor I am importing anything else) and for now I'd like to keep it in this way, also for learning purposes.</p>