Get the last character of a string without using array?

后端 未结 6 1923
甜味超标
甜味超标 2020-12-14 00:19

I have a string

let stringPlusString = TextBoxCal.text

I want to get the last character of stringPlusString. I do not want to

6条回答
  •  忘掉有多难
    2020-12-14 00:55

    "Without using Array on swift"

    Here you go:

    var text = "Lorem ipsum"
    var lastChar = text.substringFromIndex(text.endIndex.predecessor())
    

提交回复
热议问题