How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Sandeep Mohan Bhandarkar
Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a simple text with an attachment ATTACHMENT I would like to replace the occurrence of the pattern ATTACHMENT with a NSAttributedString (Containing a icon). Can some one please let me know

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Mike Abdullah
On 20 Sep 2011, at 10:16, Sandeep Mohan Bhandarkar wrote: Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a simple text with an attachment ATTACHMENT I would like to replace the occurrence of the pattern ATTACHMENT with a

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Sandeep Mohan Bhandarkar
Hi Mike, ATTACHMENT is a character sequence.. Thanks, Sandeep On Sep 20, 2011, at 2:26 AM, Mike Abdullah wrote: On 20 Sep 2011, at 10:16, Sandeep Mohan Bhandarkar wrote: Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Mike Abdullah
To find the range of the attachment, something like this: NSRange range = [[myAttributedString string] rangeOfString:@ATTACHMENT]; Then sub in your your replacement: [myAttributedString replaceCharactersInRange:range withAttributedString:myIconAttributedString]; On 20 Sep 2011, at 10:30,