Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-12-2011, 08:33 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 20
BuzzT is on a distinguished road
Post Add one string to another

I wanted to ask how to add one string to another one and set it as a new string.
Like:
NSString *newString = [String1 + String2]
BuzzT is offline   Reply With Quote
Old 04-12-2011, 08:37 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

stringByAppendingString is what you want for that:

Code:
aString = [string1 stringByAppendingString:string2];
Meredi86 is offline   Reply With Quote
Old 04-12-2011, 08:43 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 20
BuzzT is on a distinguished road
Default

And how to do it if i have 3 or more strings?
BuzzT is offline   Reply With Quote
Old 04-12-2011, 08:47 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Code:
NSString *newString = [NSString stringWithFormat:@"%@%@%@%@%@", string1, string2, string3, string4, string5];
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 04-12-2011, 08:50 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

grr Brian beat me to it - i knew the answer to that one as well!! lol
Meredi86 is offline   Reply With Quote
Old 04-12-2011, 09:15 AM   #6 (permalink)
Registered Member
 
ngaikwad's Avatar
 
Join Date: Feb 2011
Location: Mobile World
Posts: 450
ngaikwad is on a distinguished road
Default

NSString *newString = [NSString stringWithFormat:@"%@%@%@%@%@", string1, string2, string3, string4, string5];

or
a =a+b
nsstring a=[a stringbyappendingstring:b];
ngaikwad is offline   Reply With Quote
Reply

Bookmarks

Tags
add, string

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 363
11 members and 352 guests
dansparrow, dre, ilmman, LezB44, Nobbsy, Objective Zero, oztemel, samdanielblr, shagor012, sledzeppelin, thephotographer
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0