# Swift string handling

**URL:** <https://discourse.julialang.org/t/swift-string-handling/10622>\
**Category:** Offtopic\
**Created:** [April 30, 2018, 12:31pm UTC](https://discourse.julialang.org/t/swift-string-handling/10622 "2018-04-30T12:31:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 30, 2018, 1:43pm UTC](https://discourse.julialang.org/t/swift-string-handling/10622/3 "2018-04-30T13:43:02Z")

</div>

> [@Swift for Tensorflow rationale](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/10):
>
> Currently, Swift has much better support for string handling than Julia

Please stop with the FUD; we all know that you prefer a different string design, but your endless refrain that disagreeing with you equates with a second-class design is tiresome. Swift’s `String` type reportedly uses a single variable-width encoding internally (UTF-16 last I checked, hence relatively inefficient for mostly-ASCII data), hence has an analogue of Julia’s `nextind` to increment string indices, while its `Character` type is actually a grapheme cluster (hence variable-width and relatively slow) analogous to Julia’s `graphemes` iterator over substrings. It also exposes iterators over code points and code units, but as far as I can tell these don’t support random access (only forwards and backwards iteration). Swift’s strings are mutable with copy-on-write semantics, whereas Julia uses `IOBuffer` for string building. Tastes differ, but it is not obviously superior to Julia’s approach, nor does it have major functionality that Julia lacks.

---

_[View the full topic](https://discourse.julialang.org/t/swift-string-handling/10622)._
