• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TM character blows array out of water
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TM character blows array out of water


  • Subject: Re: TM character blows array out of water
  • From: Ondra Cada <email@hidden>
  • Date: Tue, 3 Sep 2002 03:16:59 +0200

On Tuesday, September 3, 2002, at 02:08 , Matt Neuburg wrote:

I am trying to construct an array of NSStrings one of which contains the TM
character. Here's the code; it's rather long-winded because I had to pull
it apart in order to debug:

- (void) awakeFromNib {
NSArray* arr2;
unichar TM = 8482;
NSString* TMStr = [NSString stringWithCharacters: &TM length:1];
NSString* NAV = [NSString stringWithFormat: @"NAV%@ 6.0 QuickScan", TMStr];
NSMutableArray* arr = [NSMutableArray arrayWithObjects:
@"AppleShare PDS", @"Desktop DB", nil];
[arr addObject: NAV]; // ***
arr2 = [NSArray arrayWithArray: arr];
}

I can see in the debugger that up to the starred line everything is fine;
the array arr has been created, and the string NAV looks the way I want.

But after the starred line - that is, as soon as I try to add this string
to this array - everything goes haywire....

Don't see any problem here:

189 /tmp> more q.m
#import <Foundation/Foundation.h>
int main() {
[NSAutoreleasePool new];
{
NSArray* arr2;
unichar TM = 8482;
NSString* TMStr = [NSString stringWithCharacters: &TM length:1];
NSString* NAV = [NSString stringWithFormat: @"NAV%@ 6.0 QuickScan"
, TMStr];
NSMutableArray* arr = [NSMutableArray arrayWithObjects:
@"AppleShare PDS", @"Desktop DB", nil];
[arr addObject: NAV]; // ***
arr2 = [NSArray arrayWithArray: arr];
NSLog(@"%@",arr2);
}
return 0;
}
190 /tmp> cc -framework Foundation q.m && ./a.out
2002-09-03 03:13:44.631 a.out[17749] <CFArray 0x99260 [0x8016024c]>{type = immutable, count = 3, values = (
0 : AppleShare PDS
1 : Desktop DB
2 : <CFString 0x90c50 [0x8016024c]>{contents = "NAV\\u2122 6.0 QuickScan"}
)}
191 /tmp>

Perhaps your compiler is fed up of your uppercase variables (all variables should begin by a lowercase!!!) and started playing tricks on you? ;)

---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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.

References: 
 >TM character blows array out of water (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re(2): [OT] FSpDirCreate returning fnfErr on X, but not 9.
  • Next by Date: Re(2): [OT] FSpDirCreate returning fnfErr on X, but not 9.
  • Previous by thread: TM character blows array out of water
  • Next by thread: Re: TM character blows array out of water
  • Index(es):
    • Date
    • Thread