如何在iPhone中串联两个字符串 [英] how to concatenate two strings in iphone
本文介绍了如何在iPhone中串联两个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此代码中,我分别发送代码号和电话号码,我有两个textFiedls电话代码号字段和电话号码字段,但是我想将代码号和电话号码字段连接起来并作为完整的手机号码发送。 ..
In this Code here i am sending Code number and phone number seperatly, i have two textFiedls phone code number field, and phone number field, but i want to concatenate code number and phone number field and send it as full mobile number...
请帮助我如何连接密码和电话号码。
Please help me how to concatenate codenumber and phone number.
self.operatorLbl.text = self.operatorStr;
self.codeLbl.text = self.codeStr;
self.phoneNumLbl.text = self.phoneNumStr;
self.balanceLbl.text = self.balanceStr;
[post orderConfirm: self.operatorLbl.text :self.codeNumLbl.tex :self.phoneNumLbl.text :self.balanceLbl.text];
我在此程序中非常新,需要您的帮助
I'm very very new in this program need your help
推荐答案
//1st Way
NSString *finalString = [NSString stringWithFormat:@"%@ %@",firstString,secondString];
//2nd Way
NSString *finalString = [firstString stringByAppendingFormat:@" %@",secondString];
//3rd way
NSArray *ary= [NSArray arrayWithObjects:firstString,secondString, nil];
NSString *finalString= [ary componentsJoinedByString:@" "];
这篇关于如何在iPhone中串联两个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文