首页 > 编程语言 > 详细

swift - use backslash to add the value in the string

时间:2016-03-08 14:56:54      阅读:198      评论:0      收藏:0      [点我收藏+]

There’s an even simpler way to include values in strings: Write the value in parentheses, and write a backslash (\) before the parentheses. This is known as string interpolation.

  1. let apples = 3
  2. let oranges = 5
  3. let appleSummary = "I have \(apples) apples."
  4. let fruitSummary = "I have \(apples + oranges) pieces of fruit."

swift - use backslash to add the value in the string

原文:http://www.cnblogs.com/facial/p/5254033.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!