Delete last character in Swift 3

后端 未结 2 1439
不知归路
不知归路 2021-01-05 03:49

I\'m creating a simple calculator app and currently struggling at deleting the last character when a my button is tapped. I\'m using the dropLast() method but I

2条回答
  •  情歌与酒
    2021-01-05 04:26

    Remove last char from string/text in swift

    var str1 = "123456789"
    str1.removeLast()
    print(str1)
    

    output:

    12345678

提交回复
热议问题