• 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: NSString is cutting off characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString is cutting off characters


  • Subject: Re: NSString is cutting off characters
  • From: Ali Ozer <email@hidden>
  • Date: Sun, 16 Feb 2003 14:10:43 -0800

gaugePath = [[NSString alloc] initWithString:percentUsed];
gaugePath = [gaugePath stringByAppendingPathExtension:@"tif"];

So the simplest solution would seem to be, make a new string with the
percentUsed string and add the path extension. Pass that as the path to a
method call looking inside the bundle, and I can get an numbered image that
way (which is what I'm going for, without declaring 100 static strings to be
able to have a solid path)

But, when I run the above code, or any other stringAppending technique I
could find, the following is what happens:
87.if

Do you have a "%" character in your percentUsed string, and later, are you using it as a format string someplace, like perhaps in your NSLog? See:

NSString *gaugePath = [[NSString alloc] initWithString:@"87%"];
gaugePath = [gaugePath stringByAppendingPathExtension:@"tif"];
NSLog (gaugePath);
NSLog (@"%@", gaugePath);

you get:

87.if
87%.tif

That's because when a string with "%" is used in places where formatting characters are taken into account, it will be swallowed...

Ali
_______________________________________________
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: 
 >NSString is cutting off characters (From: Brian Ganninger <email@hidden>)

  • Prev by Date: NSFileHandle question
  • Next by Date: Re: NSFilenamesPboardType
  • Previous by thread: NSString is cutting off characters
  • Next by thread: Re: NSString is cutting off characters
  • Index(es):
    • Date
    • Thread