swift - use backslash to add the value in the string

Posted facial

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift - use backslash to add the value in the string相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

Send Push Notifications to iOS Devices using Xcode 8 and Swift 3, APNs Auth Key

Swift 提示:Initialization of variable was never used consider replacing with assignment to _ or removi

There is no type initializer in Swift----One answer is to use static, it is the same as class final.

iOS遇到的问题:OC与swift混编造成的 Failed to emit precompiled header

JsonParseException:非法的unquoted字符((CTRL-CHAR,代码9)):必须被转义

Closure use of non-escaping parameter 'xxx' may allow it to escape