I'm working through Cocoa smoothly, but this problem seems so basic it cancels out all the cool stuff I learned. :/
I have a generated file path, and it needs to be in NSURL format. From research, this is the code I wrote:
NSLog(@"Old path = %@", pathToFile);
NSURL *xmlURL = [[[NSURL alloc] init] fileURLWithPath:pathToFile];
NSLog(@"Ne...
I have an NSString with a number of sentences, and I'd like to split it into an NSArray of sentences. Has anybody solved this problem before? I found enumerateSubstringsInRange:options:usingBlock: which is able to do it, but it looks like it isn't available on the iPhone (Snow Leopard only). I thought about splitting the string based on ...
Which NSString encoding method will percent escape the ampersand (&) character correctly into %26?
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding
gets the spaces (%20) and other baddies but ignores ampersands!?!
...
How can I get the number of times an NSString (for example, @"cake") appears in a larger NSString (for example, @"Cheesecake, apple cake, and cherry pie")?
I need to do this on a lot of strings, so whatever method I use would need to be relatively fast.
Thanks!
...
Hey guys I have an NSString that has an ó inside, so when I put it in a TextView insted of reading "ó" I reads "A³".
So this is what I did:
self._Direccion = [self._Direccion stringByReplacingOccurrencesOfString:@"ó" withString:@"ó"];
but it's not working, I don't know why...
Is working for this:
/* á*/ self._Direccion = [s...
Hi, I am trying to get a string out of a plist file that contains a nested dictionary. This is the plist:
<dict>
<key>DataPoints</key>
<array>
<dict>
<key>source</key>
<string>BloomBerg</string>
<key>date</key>
<date>2010-01-31T14:54:13Z</date>
<key>value</key>
...
I'm creating some code that will find a space between characters, and use the characters before the space and the ones after it. These characters are stored in a NSString. Here is what I have so far, however, it's not seeing the empty character.
NSString *tempTitle = self.title;
unsigned int indexOfSpace; // Holds the index of the c...
Hi,
I'm experiencing issues when converting decimal to currency for Korean Won, Cambodian Riel and Iranian Rial and showing the result to the UILabel text.
Conversion itself passes just fine and I can see correct currency symbol at the debugger, even the NSLog prints the symbol well.
If I assign this NSString instance to the UILabel t...
Hi
I have several core data entities that contains a bunch of empty NSString properties.
I parse some XML and set the properties I can get a hold of and would like to set the "empty" ones to "n/a" as in "not available". So if my XML does not contain the values it sort of tidy up the Entity by giving it a "n/a" string I can test for lat...
I have an NSString date (@"Mon, 01 Feb 2010 20:25:37 +0000") that I want to change into a timestamp so that I can better calculate how much time has elapsed from the current time. How can I change the NSString date into a timestamp value?
...
Here is my question.
NSString *xyz=[NSString stringWithFormat:@"%i %@",10,@"Sagar"];
Now I am taking other string, as follows.
NSString *x2=[xyz copy];
I exactly don't know what will happen here?
( Is it something like, x2 has the ref of xyz's ref. )
NSString *x3=[xyz retain];
( What will happen here, x3 has a new memory having...
I've got a textfile (songlist.txt) which my app retrieves from a server and stores locally. When I try to use the content of the file in my app I am getting unexpected results. When I looked into the issue, I found that strange characters sometimes were appearing at the end of the NSString contents of the textfile.
Why are these strange...
How do I save an NSString as a .txt file on my apps local documents directory (UTF-8)?
...
Hello ! every one.
I have a little query regarding the memory management.
Let's begin with an example. Assume we have a class as follows.
@interface myClass : NSObject {
NSString *xyz;
}
@end
Now, see the implementation.
@interface myClass : NSObject {
NSString *xyz;
}
@end
@implementation myClass
-(void)abc{
// xyz a...
I am using an xml parser to populate an array. This string: 'Calle Mare de Déu de' generates an exception at [NSPlaceholderString initwithstring:]. On Snow Leopard (10.6) it reports a nil argument while on Leopard (10.5) it throws an exception but reports no error.
When I replace the string 'Calle Mare de Déu de' with 'Calle Mare de Deu...
Hola! I have an issue I thought I would throw out to the S.O. world before I spent a lot of time on it.
Basically I have a requirement where I am getting a string of text which has inline images, like for a chat bubble in a UITableView. These images are akin to sparklines and/or emoticons.
Normally for something like this I would use a...
Hi,
I'm constructing a small iphone app and using a singleton to store and update a string that gets updated when the user taps letters or numbers on the screen to form a code.
i.e. they tap 3 then S then 4 and I need to track and combine that input to give me "3S4" say. When the singleton is initialised it creates an empty NSString a...
Hi, I am in Mac.
How to get NSString (Unix style path) from FSSpec
Regards,
Dhana.
...
Using Objective-C on my iPhone, is there a built-in method for NSString that finds a string appearing BETWEEN 2 other stings?
Search "my dog is my cat's best friend"... and return everything between "dog" and "best".
Or will I have to write my own? Any good ideas on where to start?
Thanks.
...
If I have a number int aNum = 2000000 how do I format this so that I can display it as the NSString 2,000,000?
...