Basic Objective-C syntax: “%@”?

后端 未结 4 1727
囚心锁ツ
囚心锁ツ 2021-02-09 04:28

I\'m working through the Stanford iPhone podcasts and have some basic questions.

The first: why is there no easy string concatenation? (or am I just missing it?)

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-09 04:48

    That is a string format specifier. Basically it allows you to specify a placeholder in the string and the values that are to be inserted into the placeholder's spot. The link I reference above lists the different notations for the placeholders and each placeholder's specific format.

    It's just like C#'s String.Format method:

    NSLog(String.Format("My home folder is at '{0}'", absolutePath));
    

提交回复
热议问题