nsstring

Convert NSString to unsigned char * for iphone application

Hello, I am trying to convert NSString in to unsigned char* for iphone application . and i am newly for this objective C and iphone application so please help on this . Whether is there any api is there which can help for converting NSString to unsigned char*. Thanks, KamalBhr ...

NSString immutable allows to change its values?

The code below compiles and runs, BUT according to all iPhone development books and Apple documentation it shouldnt! Can someone please explain to me how come immutable NSString allows to change its values after it has been set? I thought I had to use NSMuttableString to change context of the same string variable? I am using SDK 3.1. N...

using NSString + stringWithContentsOfFile:usedEncoding:error:

Hello, all! I've got problem with use + stringWithContentsOfFile:usedEncoding:error: My problem in usedEncoding:(NSStringEncoding *)enc I don't know how can i set pointer to encoding. If i make it - programm is fail. For example, in similar function we have encoding:(NSStringEncoding)enc - without pointer! I want loading file (file h...

How to find a string in an NSArray?

This feels like such a stupid question, but how can I find a string in an NSArray? I tried using [array indexOfObjectIdenticalTo:myString] but that requires the sting to have the same address. Does anyone have any tips on how to do this? ...

Convert NSData [UIImage] to a NSString

Hi, I am aware this question has been asked several times, but I was unable to find a definate answer that would best fit my situation. I want the ability to have the user select an image from the library, and then that image is converted to an NSData type. I then have a requirement to call a .NET C# webservice via a HTTP get so ideally...

Get result from shell script objective-c

I would like to run a shell script, from a file or from an objective-c string (within the code). I would also like the shell script's result to be stored to a variable. I would not like the shell script to be split into arguments (such as setLaunchPath when I run it). For example: running this shell script "mount_webdav idisk.mac.com/...

Objective-C creating a text file with a string.

I'm trying to create a text file with the contents of a string to my desktop. I'm not sure if I'm doing it right, I don't get errors but it doesn't work either... NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES); NSString *desktopDirectory=[paths objectAtIndex:0]; NSString *filename = [desk...

iPhone XMLRequest

Hello, I have an API which sends an XML Request to a server: <?xml version="1.0" encoding="UTF-8"?> <request type="handle" action="update"> <userdata> <username>YourUsername</username> <password>YourPassword</password> </userdata> <handledata type="PERSON" id="HandleId"> <name>Mustermann</name> <firstname>Max</firstname> <organization>F...

objectForKey stringValue crashing my app?

I have a class that I use to setup objects in an array. In this class I have a custom "initWithDictionary", where I parse a JSON dictionary. However, as I am running into NSNull, this crashes my app. To get around this, I set up a class that handles exceptions, so when a string is NSNull, it's replace it with @"". or -1 for integers. Th...

Convert NSArray to NSString objective-c

Hello, I am wondering how to convert an NSArray example: ( [43,545,@"Test"] ) to a string in objective-c. An applescript example might be: set the_array to {43,"Testing", 474343} set the_array to the_array as string ...

Properly Converting NSString to CGFloat, NSInteger, etc.

I have a question about safely or properly converting an NSString into types such as CGFloat and NSInteger, considering that these are simply wrapper types that Apple created to use different primitives depending on certain factors (e.g., NSInteger is typedef'd to int on 32-bit architectures and long on 64-bit architectures). For exampl...

Compare NSString accounting for articles (i.e. "the" and "a")

I thought caseinsensitiveLocalizedCompare: would take care of this (that is not including "the" and "a" in the comparison) , but it does not. (Also, In response to the first answer below, I understand that "case insensitive" part wouldn't help, but I thought that the "localized" part may help. I can't find any options to do this and g...

How to put a date from strftime in a nsstring in obj-c?

i want to be get a date (the current hour) from strftime and get it into a nsstring in obj-c for the iphone-os ...

Cocoa: Parse NSString by character length

I have an NSString I'm working with, but I would like to parse it by character length. So break it apart into an NSArray, and have each object in the array be x characters from that string. So basically, break up the string into sub strings of a certain length So, how do I do it? example: NSString *string = @"Here is my string" NS...

how to append from NSMutableArray

hi experts, i try to append from NSMutableArray but the below exception, actually first 2 loop its giving result but the 3rd loop giving this exception 2009-12-04 12:01:19.044 AppBuzz[14562:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString appendString:]: nil argument' 2009-12-04 ...

comma separated thousand NSString stringWithFormat

Is it possible to display 1000.99 as 1,000.99 using [NSString stringWithFormat:@"£%0.2f", 1000.99] Please guide me if I am not on the right track to achieve this? ...

Search through NSArray for string.

I would like to search through my NSArray for a certain string. Example: NSArray has objects: "dog", "cat", "fat dog", "thing", "another thing", "heck here's another thing" I want to search for the word "another" and put the results into one array, and have the other, non results, into another array that can be filtered further. ...

Insert a characters in NSString

Hello all ! I am having difficulty with subj. I have NSString text, contains "SLOVO", and i need that NSMutableString* currentRequest contain "%t%e%x%t%". I trying in cycle: [currentRequest appendFormat:@"%c%%", [text characterAtIndex:i]]; It's working fine, BUT if text contain for example "Rüdiger", i mean non latin symbols, t...

How to pass a value from Cocoa to an SQLite query

Hi, first of all please let me say that I am quite new to objective c development. I am writing a small app for personal use for the iphone, but I have some problems executing the following code: NSString *sql = [[NSString alloc] initWithFormat:@"select color_r, color_g, color_b from Calendar where ROWID = %@", [calendarsID objectForKe...

How to convert a NSString to UTF-8 format string in iphone sdk?

I have localization in my app(english,spanish,italian).The client sent me strings files but some characters are strange how do i correct them? i have figured out that the client used Mac OS Roman encoding how do i convert this to utf-8. for example Nürnberg is converted into N√ºrnberg when client send me now i want to reconvert it. ...