Hello,
I'm trying to get a value from a string that belongs to an enum typedef in Obj C but I don't seem capable of geting the value out of the NSString. I'me doing something like this:
typedef enum{
S,
M,
L
} Size;
-(void)function:(NSString *)var{
Size value=[var value];
swicth(value){
case S:...
case M:...
...
}
}...
I'm having an issue with a string which is being returned from a webservice. I am setting the string up in the header file, simple with
NSString *serviceUserID;
@property (nonatomic, retain) NSString *serviceUserID;
then I'm synthesizing it as normal. I can set it using
serviceUserID = @"4fffrdscfbg-44-06dfgf-dfgdfg-32eer456134";
b...
I have a url in an iphone application to work with.But the problem is that it has some spaces in that. I want to replace the spaces with '%20'.I know that there is stringByReplacingOccurancesOfString methode and stringByAddingPercentEscapesUsingEncoding methode.I also have used them. But they are not working for me. The spaces are replac...
Hi guys,
I can't figure out why it's not working, I have a NSString which I need to convert to NSNumber (to save it to Core Data)
e.g
NSLog(stringNum);
returns 1
NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber *myNumber = [f numberFromString:stringNum];
[f releas...
I have an error with NSString. In one of my .m files I have a member called "conversions" of type NSString and within a method of that class the string is manipulated and added on to and etc. Well, when I try to Log that string in a different method that is later called, for some reason the string is printing as a UITouch object. Specifi...
I'm trying to understand NSString's and the complexities regarding composed character sequences. I'm having troubles creating strings containing these composed character sequences for me to be able to play around with them.
I've seen the Unicode list of sequences but I'm unable to find these characters in the Mac OS X character selecto...
What I'm trying to get is to search for the Anime Titile's ID, compare the length and perform some action afterwards. Here is what I get in the debugger:
2010-08-09 14:30:48.818 MAL Updater OS X[37415:a0f] Detected : Amagami SS - 06
2010-08-09 14:30:48.821 MAL Updater OS X[37415:a0f] http://mal-api.com/anime/search?q=Amagami%20SS
2010-0...
I want to do this:
while(theString (does not have) @"this string" (in it)) {
do something
}
...
Here is my code:
task = [[NSTask alloc] init];
[task setCurrentDirectoryPath:@"/applications/jarvis/brain/"];
[task setLaunchPath:@"/applications/jarvis/brain/server.sh"];
NSPipe * out = [NSPipe pipe];
[task setStandardOutput:out];
[task launch];
[task waitUntilExit];
[task release];
NSFileHandle * read = [out fileHandleForReading];
...
I have an image in my iPhone Project. It's a PNG and I can set the background in Interface Builder but I want to do this programatically.
NSLog(@"Before %@", myEasterEgg);
uiImageBackground.backgroundColor = [UIColor purpleColor];
myEasterEgg = [myEasterEgg stringByAppendingString:@"5"];
NSLog(@"After %@", myEasterEgg);
if (CFStringComp...
if i have:
NSString* number = @"2000";
Will NSInteger integerNumber = [number integerValue];
be equal to the integer representation of 2000?
...
I am trying to send a string terminated with \0 to a tcp socket but it seems the \0 does never reach its destination.
Using this code:
NSString* s=@"<b/> \0_";
uint8_t *buf = (uint8_t *)[s UTF8String];
int resCode = [outputStream write:buf maxLength:strlen((char *)buf)];
I only seem to send @"<b/> ". Probably the \0 is seen as the ...
Sticking to the rule of releasing everything I'm creating, why does the line [cellText release] crash my app? It must be something really simple, I'm quite new to iPhone apps dev.
...
NSMutableString *cellText = [[NSMutableString alloc] initWithString:@""];
// the cell is a section cell
if (/* some condition */) {
cellTe...
Wonder if anyone can help, I have created a database in C# 2010 (using the SQL Express installed with C# express) via the database explorer.
I can connect to the database using the connection string:
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\temp\Documents\test.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True
...
I have a NSString declared in the interface part:
@property (nonatomic, retain) NSString *filePath;
In viewDidLoad I give this a value and when I am trying to call it from one of my custom methods it works for the first time but on the second it crushes. In my opinion filePath was autoreleased during the first call.
I tried a diff...
Hi all,
I'm looking for a nice clean routine for turning an NSArray containing NSNumbers (integers) into a nice English-readable string. For example, I want to change this:
[NSArray arrayWithObjects:[NSNumber numberWithInt:5],
[NSNumber numberWithInt:7],
[NSNumber numberWithInt:12],
...
I have a connection request working using the stringWithContentsOfURL:encoding:error: method from NSString. I want to be able to retry the connection if it fails the first time. I was going to rewrite the function to use the timeout functionality of NSURLRequest, but I think I'd really like to use multiple retries before failing out.
As...
I am trying to make an app where the user clicks a button and an alert pops up with the text from a textfield in it. But whenever i try, i just get a blank alert. This is my code:
@synthesize label;
@synthesize textBox1;
@synthesize text;
- (IBAction)buttonClick {
UIAlertView *someText = [[UIAlertView alloc] initWithTitle: @"Text fr...
Hi Everyone,
I gotta little question about string Programming: I have an NSCharacterSet which contains all the characters I want to remove from my NSString.
How can I do that?
Thank you,
Christian
...
task = [NSTask new];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:[NSArray arrayWithObject:@"/applications/jarvis/brain/server.sh"]];
[task setCurrentDirectoryPath:@"/"];
NSPipe *outputPipe = [NSPipe pipe];
[task setStandardInput:[NSPipe pipe]];
[task setStandardOutput:outputPipe];
[task launch];
NSMutableString *outputString =...