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 02-03-2012, 11:31 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 83
vogueestylee is on a distinguished road
Default how to add % into one % in NSString..?

hi there, in my project it is using string like

@"this is 30% save"

but I can't edit it to @"this is 30%% save" because it is loaded from server (as NSString from NSMutableArray objectAt..... you know...)

so is there any way how to

1. take string
2. look for %
3. if there is % - add another % to work ok
4. save new string...?
vogueestylee is offline   Reply With Quote
Old 02-03-2012, 11:42 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

you should be able to do:

NSString *newStr = [oldStr stringByReplacingOccurancesOfString:@"%" withString:@"%%"];
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 02-03-2012, 11:46 AM   #3 (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

Are you sure it doesn't work already? The % thing is just for formatting, but you wouldn't be formatting this string, it is already a string.
__________________
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 02-03-2012, 11:58 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 83
vogueestylee is on a distinguished road
Default

RickSDT thank you..

I', not sure because it always make something like



Uploaded with ImageShack.us

and another time is "box with legs"..

edit: It gives me CHINESE letters ))



Uploaded with ImageShack.us

the data are from [array objectAtIndex:[indexPath row]] loaded into NSString and then shown in UITextView in custom UITableCellView...

Last edited by vogueestylee; 02-03-2012 at 12:02 PM.
vogueestylee is offline   Reply With Quote
Old 02-03-2012, 12:01 PM   #5 (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

The fact that it is in an array is irrelevant. It had to be put into the array somehow first. You said it is from a server, so there is probably a conversion issue there. The server probably needs to escape the string before it sends, if it isn't doing so already, and you probably need to un-escape it on your end.
__________________
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 02-03-2012, 12:06 PM   #6 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 83
vogueestylee is on a distinguished road
Default

you mean like \n and so on? the letters that are not visible but they are there? but how to find them?

when I open in firefox or safary

www.myserver.com/xml it looks without any letters, just <title>this is 30% example</title>
vogueestylee is offline   Reply With Quote
Old 02-03-2012, 12:43 PM   #7 (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

XML Reserved Characters
__________________
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
Reply

Bookmarks

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: 387
19 members and 368 guests
Apptronics RBC, Atatator, chiataytuday, dre, FrankWeller, gwelmarten, ipodphone, jeroenkeij, jleannex55, kukat, LunarMoon, MAMN84, n00b, pbart, QuantumDoja, reficul, Retouchable, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,124
Posts: 402,909
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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