objective-c concatenation of strings in a macro

Source: Internet
Author: User

Official server
#define Api_domain @ "www.online.com"
Test server
#define DOMAINXX @ "192.168.0.10"


#define API_SYSTEM @ "/http" [email protected] "/system/"
#define API_USER @ "/http" [email protected] "/user/"


API_SYSTEM macro expands to: @ "/http" @ "www.online.com" @ "/system/"
The compiler will automatically connect the characters together for the purpose.


C-Language implementation:
Official server
#define Api_domain "Www.online.com"
Test server
#define DOMAINXX "192.168.0.10"


#define API_SYSTEM "/http" Api_domain "/system/"

#define API_USER "/http" Api_domain "/user/"


Reference:
http://stackoverflow.com/questions/8844981/ How-to-expand-a-macro-into-nsstring-without-using-any-string-concatenation-at-ru

Http://stackoverflow.com/questions/798221/c-macros-to-create-strings

objective-c concatenation of strings in a macro

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.