Santosh Santosh - 5 months ago 25
iOS Question

Remove quotes from ns mutable array

Code:

NSString *advName = result[i][@"AdvertiserName"];

NSString *trimmedString = [advName stringByReplacingOccurrencesOfString:@"\"" withString:@"sas"];

NSLog(@"%@", trimmedString);

[self.mutableNames addObject:trimmedString];
NSString *advName = result[i][@"AdvertiserName"];

NSString *trimmedString = [advName stringByReplacingOccurrencesOfString:@"\"" withString:@"sas"];

NSLog(@"%@", trimmedString);

[self.mutableNames addObject:trimmedString];

NSLog(@"%@", self.mutableNames);


self.mutableNames : The output is:

(
adcamie,
adcamie,
Advertiser,
Advertiser,
Advertiser,
Advertiser,
Advertiser,
aerocwl,
Alex,
Alex,
Alex,
Alex,
Alex,
Alex,
Alex,
Alex,
"Amanda tan",
APVISA1,
APVISA1,
chin,
"CS Yong",
"Demo Advertiser",
"dinobsya@gmail.com",
"EdmondGooY.M.",
Flannery,
"frankwong@moredesign.asia",
GANDHI,
innovation,
iristeoh,
Ivalent,
Iyashino,
jerryyong,
laich0325,
"mahyuenlung@hotmail.com",
mars,
"maxmax889@hotmail.com",
"mcom hk 2",
"mcom hk cpa",
"Mcom International HK",
"MCOM Thai",
"MCOM Thai",
MCOMMessaging,
"meifen.low@gmail.com",
Minnie,
Mobvista,
"mw_manwai",
"phyllis ng",
"Property Hunter",
"Qiji Wuxian",
"seco builtech design",
StreamerTech,
TestingAdva,
top1,
"tsuka90@gmail.com",
"yching.property@gmail.com",
youmi
)

Answer

If you want to clean up the output, you can write a simple loop:

for (NSString *name in self.mutableNames)
{
    NSLog(@"%@", name);
}