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
2
votes
2 answers

Assigning charAtIndex to stringWithCharacters gives invalid cast warning and bad access error

I'm trying to grab firstname and lastname from firstname+lastname. int loop=0; NSMutableString *firstname = [[NSMutableString alloc]init]; NSMutableString *fullName = [[NSMutableString alloc]initWithString:@"Anahita+Havewala"]; for (loop = 0;…
SeeObjective
  • 39
  • 1
  • 9
2
votes
1 answer

Check if NSString is HTML string on non-HTML?

I am using a UITextView to display text on a screen. I also want to display HTML text in the same TextView. What I want is, when the string contains any HTML data then it should be displayed according to HTML formatter otherwise textview should use…
Santosh
  • 1,254
  • 2
  • 16
  • 31
2
votes
1 answer

How to change the format of phone number in ABAddressBook?

I'm making a social App, and I have to implement ABAddressBook with name, and phone number. I would like to format phone number for example : +33 6 01 23 45 67 becomes 0601234567 (French phone number). So, I want to delete spaces, and transform +33…
Vjardel
  • 1,065
  • 1
  • 13
  • 28
2
votes
1 answer

Removing the rtf format and tags from nsMutableString

I am trying to display the contents of a rtf file in uiwebview. I do this by taking the contents of rtf into nsmutablestring and loading it into uiwebview. The problem is along with the content of rtf, the rtf tags and format is also passed in the…
Jayshree
  • 281
  • 1
  • 6
  • 28
2
votes
2 answers

NSMutableString leaks on append or replaceOccurrencesOfString

I know similar questions have been asked time and time again but I ask that you please bear with me as I cannot seem to find an answer that helps. My application has leaks that are driving me out of my mind. Actually, they are not reported as leaks…
2
votes
6 answers

NSString append WhiteSpace for every 4 Character

I have a string like @"1234123412341234", i need to append space between every 4 chars like. @"1234 1234 1234 1234" i.e, I need a NSString like Visa Card Type. I have tried like this but i didn't get my result.…
Harish
  • 2,496
  • 4
  • 24
  • 48
2
votes
5 answers

NSMutable String "Out of scope"

I have two NSMutableString objects defined in my viewController's (a subclass of UITableViewController) .h file: NSMutableString *firstName; NSMutableString *lastName; They are properties: @property (nonatomic, retain) NSMutableString…
Garry Pettet
  • 8,096
  • 22
  • 65
  • 103
2
votes
2 answers

How to fix warning: Incompatible pointer types assigning to 'NSMutableString *' from 'NSString *'

I have this line of code that is giving me a warning: result = [result substringToIndex:[result length] - 1]; The warning is: Incompatible pointer types assigning to 'NSMutableString *' from 'NSString *' I think I understand what the problem is…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
2
votes
1 answer

'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'

Im inserting a string into a NSMutableString like as NSMutableString *string = (NSMutableString *)self.label.text; [string insertString:@"New " atIndex:0]; these line of codes working properly iOS 6 device. but in iOS 7 it throws an exception as…
Srinivas
  • 315
  • 3
  • 18
2
votes
2 answers

Objective-c - NSMutableString setString vs NSString

Is it a better practice, in a setter, to retain and release NSString as follows : -(void) setName:(NSString *)newName { if(newName != nil) { [newName retain]: [m_Name release]; m_Name = newName; //Where m_Name is a…
2
votes
2 answers

Fastest way to manipulate strings in objective-c

I'm relatively new to Objective C and I'm trying to figure out how to efficiently replace a character in a string in the case that I know the index where that character would be. Basically if S is my string I would like to be able to do this s[i] =…
Amit Farkash
  • 329
  • 3
  • 16
2
votes
1 answer

Concatenate NSStrings from NSMutableArray to NSString

I need to create a NSString for browsing folders in FTP share. i show the directory on a TableView, and user´s can browse by selecting row ´s Im writing the string of selected rows into a mutable array, and then i need to make a string of all…
HugoBoss
  • 95
  • 3
  • 11
2
votes
2 answers

Replace String not work

I need to add the string @"d" after "id=" Example = url = @"id=63488320543140151742289377" needs to be url = @"id=d63488320543140151742289377" I have tried this: NSRange range = [url rangeOfString:@"id="]; [url…
Ladessa
  • 985
  • 4
  • 24
  • 50
2
votes
3 answers

How do I add a character to an already existing string?

When I make: NSString x = @"test" How do I edit it so that it becomes "testing"? And when I put: NSMutableString x = [[NSMutableString alloc] initWithString:@"test"]; There is an error that says: Initializer element is not a compile-time…
Nikita Jerschow
  • 836
  • 2
  • 11
  • 24
2
votes
1 answer

Is CFStringTransform thread safe and reentrant?

I see my app is stuck in deadlock state(the main thread is waiting in semaphore_wait_trap, see call stacks below) several times while calling more than one instances of CFStringTransform simultaneously in global background queue as…
an0
  • 17,191
  • 12
  • 86
  • 136