Questions tagged [nsmutablestring]

The NSMutableString class declares the programmatic interface to an object that manages a mutable string — that is, a string whose contents can be edited — that conceptually represents an array of Unicode characters.

To construct and manage an immutable string — or a string that cannot be changed after it has been created — use an object of the NSString class.

The NSMutableString () class adds one primitive method

-replaceCharactersInRange:withString:

to the basic string-handling behavior inherited from NSString . All other methods that modify a string work through this method.

More information : NSMutableString Class reference

306 questions
0
votes
3 answers

NSMutableString Append Fails

I have an NSString that I'd like to append a { at the beginning of it. NSMutableString *str = [[NSMutableString alloc] initWithString:@"{"]; [str stringByAppendingString:extracted]; This returns str with only {. Why is that? Objective-C is…
darksky
  • 20,411
  • 61
  • 165
  • 254
0
votes
1 answer

NSMutableString is not appending, it's allways null

I'm trying to set a NSMutablearray, but always get null value, it doesn't update with different values on the iterations. Here is the code: NSMutableString *tipo = [NSMutableString stringWithString:@""]; if (self.canas.on){ …
theomen
  • 913
  • 3
  • 20
  • 39
0
votes
1 answer

Appending NSMutableStrings - Exepected "." before "." token error

I'm not sure what I'm doing wrong. I'm thinking its because the NSMutableArray's *name and *field are declared in a different file. #import @interface xmlToUrl : NSObject { NSString *base_url; NSMutableArray…
MrHappyAsthma
  • 6,332
  • 9
  • 48
  • 78
0
votes
1 answer

IOS - NSMutableString: appending, and initializing a property

I'm obviously not getting something with this. I'm parsing an XML Document so I have an NSMutableString to append to for one of the elements because foundCharacters gets cut off and does it in pieces. I can get this all working but I don't…
Doug
  • 1,316
  • 6
  • 19
  • 36
0
votes
1 answer

Find a random string in NSMutableString

I have seen a lot of q&a on how to generate random strings. But what about the case where I have an array of strings (perhaps thousands) and I want to grab a random string so a different one is presented to the user each time? Thanks in…
user1278974
  • 215
  • 3
  • 11
0
votes
3 answers

Dynamica string count in NSMutableArray in NSMutableDictionary

I am familiar with getting a string count from a known array int numberOfWords = [self.wordArray count]; but I have an unknown number of strings in an unknown number of arrays, all referenced by a dictionary. This works - good. …
user1278974
  • 215
  • 3
  • 11
0
votes
1 answer

Getting an error when using replaceOccuranceOfString function

[str replaceOccurrencesOfString: withString: options: range: [str replaceOccurrencesOfString:@"'" withString:@"!~" options:0 range:NSMakeRange(0,str.length)] I am using this function to replace ' symbol in my NSMutableString with !~ symbol so that I…
Hemang
  • 26,840
  • 19
  • 119
  • 186
0
votes
1 answer

Cocos2D: EXC_BAD_ACCESS when using NSMutableString in CCCallFuncND action

I have an NSMutableArray called message that I've alloc'd in init and release in dealloc. I can usually use a string in a CCCallFuncND action without a problem, even if it's an index of an array, such as: displayMessagePiece = [CCCallFuncND…
-1
votes
2 answers

Replacing a NSMutableString with another string

I want to replace NSMutableString with another String (Not a part of string but complete string) I tried different approaches but couldnt find a better solution.
user1065969
  • 589
  • 4
  • 10
  • 19
-1
votes
1 answer

How to customize String in specific range? - Swift

I'm a beginner in Swift and I want to make a custom Label on some letters the font to be bigger, and on some others to be smaller. Like on image: Click here to open the image So, the currency symbol and decimal points should be in a smaller font…
-1
votes
1 answer

String as key in a mapping

I want to store an object in an NSMutableDictionary with a string key, so I have made the declaration like this: [m_pMsgIdToStructMap setObject:pStruct forKey:[NSMutableString…
spandana
  • 755
  • 1
  • 13
  • 29
-1
votes
4 answers

Getting error while converting Json data to Object in iOS

I am using an API to convert Json Data into Object data, please visit the API I am using Please Visit the API page which I am using Here is the snap of my code with highlighted issues Issues and here is the raw code -(void) retrieveData{ …
Faiz Fareed
  • 1,498
  • 1
  • 14
  • 31
-1
votes
4 answers

how to replace the content of NSMutablestring in objective c

I am new in objective c. I want to replace the content of mutable string I am using code as NSMutableString *myMutableStringObj = [myMutableStringObj stringByReplacingOccurrencesOfString:@" & " withString:@"And"]; But It Shows me warning…
user6577540
-1
votes
2 answers

How to get the first 40 characters of a NSString in a line

I have a NSString. I am trying to take the first 40 characters of the first line. As of now, I have done this. NSString *text = @"Somewhere, something incredible is waiting to be known"; text = [text substringToIndex:40]; NSLog(OUTPUT : %@, text);…
Sheik_101
  • 770
  • 1
  • 8
  • 24
-1
votes
1 answer

Getting an error when creating an NSMutableString when iterating an NSCountedSet in Objective-C

I am iterating an NSCountedSet in a for-loop, and then trying to create an NSMutableString that is composed of the NSString object it holds, as well as the count for that particular object, and then insert the newly created NSMutableString into an…
syedfa
  • 2,801
  • 1
  • 41
  • 74