Re: Trying to make an NSString...
Re: Trying to make an NSString...
- Subject: Re: Trying to make an NSString...
- From: Jeff LaMarche <email@hidden>
- Date: Sun, 28 Apr 2002 20:27:42 -0700
- Resent-date: Sun, 28 Apr 2002 20:28:20 -0700
- Resent-from: Jeff LaMarche <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: email@hidden
Well, the error you're getting is that initWithString is an instance
method and you're calling it like a class method. You were probably
thinking of +stringWithCString:(char *), which would have worked...
BUT... there's a much easier way...
You can use all the normal C escape characters in an NSString... You
want to create an NSString that has just a tab? Try this:
NSString *tabString = @"\t";
On Sunday, April 28, 2002, at 08:15 PM, Joel Rosenblum wrote:
I want to make an NSString which contains a tab character. Since I
can't put that into the @"" literal construct, I figured I'd try
putting it into a CString and then making the NSString from that. Here
was my unsuccessful attempt:
char cTabString[2];
id tabString;
cTabString[0] = 9;
cTabString[1] = 0;
tabString = [NSString initWithCString:cTabString]
So what am I doing wrong? I get some unhelpful compiler warnings such
as:
MyScrollView.m:10: warning: cannot find class (factory) method.
MyScrollView.m:10: warning: return type for `initWithCString:' defaults
to id
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.