• 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
NSString componentsJoinedByString--strange output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString componentsJoinedByString--strange output


  • Subject: NSString componentsJoinedByString--strange output
  • From: Kevin Walzer <email@hidden>
  • Date: Sun, 22 Nov 2009 22:28:05 -0500
  • Organization: WordTech Communications LLC

I'm trying to join an array of file paths into a single string delimited by tabs, and I'm getting strange output from NSLog. Here's my code:

// gcc -o stringtest test.m -framework Foundation
// ./stringtest

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool *pool;
    pool = [NSAutoreleasePool new];

NSArray *files;
files = [NSArray arrayWithObjects: @"/Users/kevin/Desktop/foo.txt", @"/Users/kevin/Desktop/bar.png", @"/Users/kevin/Desktop/baz.txt", nil];


NSString *filestring = [files componentsJoinedByString:@"\t"];

NSLog(@"%s", filestring);

[pool drain];
    return 0;
}


Here's the result:

Macintosh:Desktop kevin$ ./stringtest
2009-11-22 22:25:47.251 stringtest[33157:10b] †dx†≠

I have no idea what "†dx†≠" is. I'd expect something like this:

/Users/kevin/Desktop/foo.txt /Users/kevin/Desktop/bar.png /Users/kevin/Desktop/baz.txt

Any idea what the problem is? I've looked at the methods and various websites and can't find what I'm doing wrong.

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSString componentsJoinedByString--strange output
      • From: Joar Wingfors <email@hidden>
    • Re: NSString componentsJoinedByString--strange output
      • From: Roland King <email@hidden>
  • Prev by Date: Re: [SOLVED] CoreData/NSPersistentDocument initialization
  • Next by Date: Re: NSString componentsJoinedByString--strange output
  • Previous by thread: Re: mySQL client lib linking problem...
  • Next by thread: Re: NSString componentsJoinedByString--strange output
  • Index(es):
    • Date
    • Thread