# Give Int an initializer that takes a single Character

**URL:** <https://forums.swift.org/t/give-int-an-initializer-that-takes-a-single-character/10346>\
**Category:** Pitches\
**Tags:** string\
**Created:** [February 26, 2018, 7:14pm UTC](https://forums.swift.org/t/give-int-an-initializer-that-takes-a-single-character/10346 "2018-02-26T19:14:31Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Nevin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nevin/32/617_2.png) [@Nevin](https://forums.swift.org/u/Nevin)\
**Post date:** [February 26, 2018, 8:06pm UTC](https://forums.swift.org/t/give-int-an-initializer-that-takes-a-single-character/10346/5 "2018-02-26T20:06:20Z")

</div>

> [@lancep](#):
>
> I’ll admit, I don’t hit this a lot. But it is one of those things where it seems silly to have to make a heap allocation for a String to just parse out the Int from a Character you already have.

Once we get short-string optimizations as discussed in [this thread](https://forums.swift.org/t/state-of-string-abi-performance-ergonomics-and-you/7397) (similar to [`NSString` tagged-pointers](https://www.mikeash.com/pyblog/friday-qa-2015-07-31-tagged-pointer-strings.html)) then there won’t be any heap allocation for this scenario. Hopefully that should land by Swift 5.

---

_[View the full topic](https://forums.swift.org/t/give-int-an-initializer-that-takes-a-single-character/10346)._
