How do I concatenate strings in Swift?

前端 未结 20 1854
梦毁少年i
梦毁少年i 2020-11-28 03:04

How to concatenate string in Swift?

In Objective-C we do like

NSString *string = @\"Swift\";
NSString *resultStr = [string stringByAppen         


        
20条回答
  •  盖世英雄少女心
    2020-11-28 03:47

    I just switched from Objective-C to Swift (4), and I find that I often use:

    let allWords = String(format:"%@ %@ %@",message.body!, message.subject!, message.senderName!)
    

提交回复
热议问题