I've got a problem with a NSString in my app.
I've defined it in the header file of my view controller.
NSString *locationCoordinates;
and I set its value in a -(void) method.
- (void)locationUpdate:(CLLocation *)location {
<...>
NSArray *locArray = [locString componentsSeparatedByString:@", "];
NSString *xCoordinat...
Is there a way to get the correct size of an NSString using:
- (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode
that doesnt get thrown off by 2 or 3 hundred character strings. At the moment if I try to use this method on these long strings it incorrectly calculates them and I end...
I'm familiar with sizeWithFont: for the iPhone. Now I'm trying to build an app for the Mac and need something like that, but I don't know how to do it :/
Here's why I need it: I've got a panel that displays some text, and I want to size it so that it just fits the content (a NSTextView). How would you do it?
...
I want to check if an NSString is a valid URL so I can parse it to an NSURL variable... is there an easy way to do this? :)
CRASH
For some reason the app crashes when checking.....
NSURL *shortURL = [[NSURL alloc] initWithString:data];
if(shortURL == nil)
{
NSLog(@"INVALID");
}
else {
NSLog(@"COOOL");
}
The console gives me t...
I have some sensitive data I want to clear directly after use. Currently, the sensitive data is in the form of NSString. NSString is in my understanding immutable, meaning that I can't really clear the data. NSMutableString seems more appropriate, though, as it is mutable and has methods like replaceCharactersInRange and deleteCharacters...
Possible Duplicate:
Number of occurrences of a substring in an NSString?
I would like to know if there's a method which returns the occurrence of a given word.
NSString *string = @"ok no ok no no no ok";
// How to return 4 for the word no ?
Thanks for your help !
...
I have an NSString that might contain 5-10 different style dates and times.
I need to convert all of them into NSDates.
Does dateWithNaturalLanguageString no longer exist in iPhone SDK 3.1.3?
I do NOT need to convert things like @"last Wednesday at 1 pm".
I need to convert things like:
@"01-Feb-2010"
@"Feb 1, 2010"
@"February 1, 2010"...
Hey all,
I am working with the iPhone SDK and I have to process a webservice response I receive from an external service.
The response data consists of an XML string that was UTF8-encoded to a byte array.
This byte array is converted to string
This string is put into a XML wrapper element
The wrapper is returned via an HTTP response
...
Hello,
I have searched for hours now and haven't found a solution for my problem. I have a NSString which looks like the following:
"spacer": ["value1", "value2"], "spacer": ["value1", "value2"], ...
What I want to do is to remove the [ ] characters from the string. It's seems to be impossible with objective-c. Most other programming...
how to convert NSarray into NSString in objective-c.
...
On objective-c with iPhone:
I want to make a append with strings, but can I use autorelease? Is this right?
NSString *str1 = [[NSString alloc] initWithString:@"STR1"];
NSString *str2 = [[NSString alloc] initWithString:@"STR2"];
NSString *s = [[str1 autorelease] stringByAppendingString:[str2 autorelease]];
will this remove the *str1...
Hi.
I have a UIImage with some text I´ve done it creating a RGB Context, after that I use drawinrect method to write the text on that context and finally I create a CGImage with CGBitmapContextCreateImage function. Then I have a black background with white text over.
What I want now is to change the white pixels (text) for other value (...
I am using the NSURLRequest class in my iPhone app, and the method that calls it returns an NSString which is great for when the connection goes through ok, but the issue is I need to convert the NSError into an NSString so I can either return it back or run some if() statements on it.
Any ideas? :)
...
How can I calculate the number of differences between two NSStrings.
Example:
NSString 1 = this is a string
NSString 2 = Tihs isa string
should return: 4 (one for the capital "T", one for the "i", the "h" and for the missing space)
...
SO
I wish to check to see if the item in my array [clientDataArray objectForKey:@"ClientCompany"] is nil.
temp = [clientDataArray objectForKey:@"ClientCompany"];
if (temp != [NSNull null]) infofieldCompany.text = temp;
So far I have been able to achieve this through the above code, but it does give me the warnings
warning: '...
Hi
I am trying to send some text in an email from my cocoa app (by using Mail.app). Initially I tried using HTML to send properly formatted text. But the mailto: URL does not support html tags (even after setting headers)
So I decided to use formatted string (left-aligning of string) This is what I have in my mailto: link's body argume...
I'm trying to pass the following string:
NSString* jsString = [NSString stringWithFormat:@"myFunc(\"%@\");", myParameter];
from Objective C to JavaScript using the stringByEvaluatingJavaScriptFromString, where myParameter is a string value. How can I ensure that the myParameter string doesn't contain any JS-unsafe characters without b...
How do I convert a std::basic_string to a NSString ?
...
Is anyone aware of a category on NSString or NSMutableString that allows for templating? I'd like to create a template and use tags for variables, then "apply" a KVC-compliant object against the string to have the variables replaced.
Or another way of asking... How is templating currently done in the iPhone / Objective-C universe? Is ...
How can I format a users text field input as they type and insert a "-" or " " on every 5th character.
4500000000000000 becomes 4500 0000 0000 0000
...