search

Home  >  Q&A  >  body text

IOS swift 如何在string中的index位置再插入一个string呢,请大神们不吝赐教

是不是需要转化成NSString或者NSMutableString呢,求具体的实例代码。感激不尽!

高洛峰高洛峰2888 days ago211

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 17:59:23

    The index of Swift string is not easy to operate, but this requirement is not difficult to achieve

    var str2 = "world"
    var str1 = "hello,"
    str1.insertContentsOf(str2.characters, at: str1.endIndex)
    print(str1)

    reply
    0
  • Cancelreply