Re: stringByTrimmingCharactersInSet: Bug
Re: stringByTrimmingCharactersInSet: Bug
- Subject: Re: stringByTrimmingCharactersInSet: Bug
- From: "Ujwal S. Sathyam" <email@hidden>
- Date: Thu, 03 Apr 2003 00:20:16 -0800
Yes, I have. This is what I have in my code:
if([aString length] > 1) // Cocoa bug?
aString = [aString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
But it is sounding like my code may not work if there are white space characters prefixed to the target character/string...I will test.
Ujwal
Message: 2
Date: Wed, 2 Apr 2003 17:43:08 -0500
Subject: stringByTrimmingCharactersInSet: Bug
From: Wesley Miaw <email@hidden>
To: email@hidden
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Has anyone else encountered this bug with the NSString stringByTrimmingCharactersInSet:? If I attempt to trim whitespaceCharacterSet off of a string of one character (e.g. 'a'), prefixed by zero or more whitespace characters, and followed by no whitespace characters, then the empty string is returned instead of the one character. Appending whitespace to this string before calling stringByTrimmingCharactersInSet: fixes this problem.
- --
Wesley Miaw, Wesley Miaw Consulting
http://www.wesman.net/
-----BEGIN PGP SIGNATURE-----
_______________________________________________
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.