利用appendContentsOf相加字串

比較麻煩的做法

var movieQuote:String? = "Life was like a box of "

if let quote = movieQuote {
    movieQuote = quote + "chocolates"
}

比較好的做法

var movieQuote:String? = "Life was like a box of "

movieQuote?.appendContentsOf("chocolates")

results matching ""

    No results matching ""