Q: I have the following code:
NSString *String=TextField1.text + TextField2.text
its giving the error: -invalid operands to binary expression ('NSString *' and 'NSString *')
An:
You cannot do it this way, because objective-c doesn’t use ‘+’ operator for concatenation This way should work:
NSString *concat = [NSString stringWithFormat@"%@%@", TextField1.text, TextField2.text];
or
NSString *concat = [TextField1.text stringByAppendingString:TextField2.text];
Hope this works for you ;)
from stackoverflow