nsstring

NSURL not working.

Hi, I wanted to ask if anyone could help he get this code to work. Nothing is showing up in my MySQL database. Thanks, enbr. NSString *urlstr = [[NSString alloc] initWithFormat:@"http://mysite.come/myapp/submitrating.php?name=%@&comment=%@&rating=%@", [selectedItem objectForKey:@"name"], comment.text, selecte...

How to find beginswith word in a string using NSPredicate?

Hello! I am searching for a solution on how to format NSPredicate to search correct word in a string of text. Currently I am using this code: NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(content CONTAINS[c] %@)", word]; but it returns wrong resuls if the word is short, for example: if the wo...

Several lines of code, that blows my mind (or NSString "out of scope" dilemma.. again)

Hey, everyone! I'm totally confused with this small "out of scope" thing. So here is some code to describe my situation: Simple iphone view-based application. View controller header: #import <UIKit/UIKit.h> @interface global_nsstring_testViewController : UIViewController { UIImageView* image_view; NSString* image_name; } @propert...

Equality with CoreData string attribute not working

Hello, I can't see why this isn't working. I have two entities, let's call them Employees and Departments. And Departments has a String attribute called division. This works perfectly: NSLog(@"Division: %@",employee.department.division); The console shows, let's say, "Worldwide Seafood". But if I attempt a comparison with the exac...

iPhone - Check if character is capital

Hey! I was wondering if there was any way to check if the first letter of a string was capital or not in an NSString. Something similar to: if ([[string substringToIndex:1] isCapitalLetter]) { // CODE } --or-- if ([self isCapitalLetter:[string substringToIndex:1]]) { // CODE } ...

Make C char array from NSString object in Obj-C.

Hi, I want to make a C char array from NSString object in Obj-C. My string is: NSString *string = [[NSString alloc] initWithContentsOfURL:url usedEncoding:nil error:nil]; Can someone send me a sample of a working code? Thanks in advance, Sagiftw ...

Finding a substring in a NSString object

Hi, I have an NSString object and I want to make a substring from it, by locating a word. For example, my string is: "The dog ate the cat", I want the program to locate the word "ate" and make a substring that will be "the cat". Can someone help me out or give me an example? Thanks, Sagiftwenter code here ...

Replace a substring with another substring

Hi, I want to replace the string "abc" to "def" each time it appears in my NSString object: "axcd abc amamam dff abc kdj abc" How do I do that?? Thanks, Sagiftw ...

Why isn't the NSNumber class correctly converting my NSString object to a long long?

Hello. I'm trying to convert an NSString object to an NSNumber with the same numerical value. When I create the NSString object using this statement... NSString *songID = [localNotif.userInfo objectForKey:@"SongID"]; the var songID contains the string value @"10359537395704663785". and when I attempt to convert it to an NSNumber ob...

Parsing NSString to get data out

Hey all, I have this code... NSData* myData = producedData; NSLog(@"Contents of myData: %@", myData); The log prints { "id" = ""; "level" = "level_1"; "handle" = test; } How do I get the values for id and level and handle out of this? The original data is a NSString*. Thanks! ...

Always getting the same height using sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:

The CGSize returned by sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: contains always the same height. Why is that, and is there a way around this? I want to align a string vertically and it may not be truncated, unless it can't fit on a single line using the minimum font size. So I try to use this method to get the lin...

Assigning same NSString multiple times

Can an NSString be reused like this: NSString *string = @"first value"; NSLog(string); string = @"second value"; NSLog(string); This works when tested, but is it proper coding? Thanks. ...

NSPredicate for an NSManagedObject's string attribute's length

Could someone please help me define a predicate that returns only NSManagedObject's who's "letters" attribute length is within a certain range? Here's the example I've been trying, I've got a feeling it's the letters.length notation, I've also tried the kvc letters.@length with no success.. What am I doing wrong? NSManagedObjectContext...

Passing Several NSStrings to another view - Iphone

Hi In my iPhone app, the user will be making multiple NSStrings. Once these are made, I need to pass them to another view completely in the app. How can i do this? All I know at the moment os I can't access objects or variables declared in one view, in another. Thanks. ...

Constant NSString release

NSString *string = @"hello"; 1) I keep reading that constant NSString does not get released, but this Apple page mentions: the compiler makes such object constants unique on a per-module basis, and they’re never deallocated, though you can retain and release them as you do any other object. http://developer.apple.com/mac/...

Is there a way to get an NSArray of NSRanges for an occurrence of an NSString inside of another NSString?

Hello, I have been recently working on an easy to use Syntax Highlighting system for a personal project. So far, I have everything working properly by finding the range of specific strings and highlighting that range in the NSTextView. Everything works until you try to type a highlighted word twice, which causes the error demonstrated b...

iPhone Development and NSStrings help

Hi, I would like to make a linked word that a word will be marked and when the user touch this word, it will open a link. How can I do that? Thanks! ...

How to extract the data I want in NSString?

I have a NSString like this: 456673\tSomething But I would like to extract Something only.... ... All the data must be in this format .... xxxx\tyyyy How can I split it bases on \t? thank you. ...

How can I know upto which part in a NSString a UIlabel can contain?

I have two labels side by side in the ipad with each taking half the screen. I dont want to use the scrollview. I just want the left label to contain the exact amount of test it can and want the remaining to go to the right label. How can I get the length of the string that a fixed size UILabel can contain? ...

how to determine if NSString is normalized in NFD

Hi, i need to determine if a given NSString is in NFD form. how do i do that ? Context : the file path i get from mac OS (in form of NSString) is in canonical decomposed form ( NFD ) .. this is true especially when the filesystem is HFSPlus. http://developer.apple.com/mac/library/technotes/tn/tn1150.html#CanonicalDecomposition i nee...