How to combine two strings in Objective-C for an iPhone app

后端 未结 7 1512
名媛妹妹
名媛妹妹 2020-12-31 10:21

How can I combine \"stringURL\" and \"stringSearch\" together?

- (IBAction)search:(id)sender;{
stringURL = @\"http://www.websitehere.com/index.php?s=\";
stri         


        
相关标签:
7条回答
  • 2020-12-31 10:58

    Philippe gave a good example.

    You can also use plain stringWithFormat: method.

    NSString *combined = [NSString stringWithFormat:@"%@%@", stringURL, stringSearch];
    

    This way you can manipulate string even more by putting somethig inbetween the strings like:

    NSString *combined = [NSString stringWithFormat:@"%@/someMethod.php?%@", stringURL, stringSearch];
    
    0 讨论(0)
提交回复
热议问题