Re: formatter use for whitespace
Re: formatter use for whitespace
- Subject: Re: formatter use for whitespace
- From: Vince DeMarco <email@hidden>
- Date: Fri, 25 Apr 2003 16:28:32 -0700
Here is one
#import "SpaceFormatter.h"
@implementation SpaceFormatter
- (BOOL)getObjectValue:(id *)objectValue
forString:(NSString *)string
errorDescription:(NSString **)error
{
NSMutableString *mString;
mString = [string mutableCopy];
CFStringTrimWhitespace((CFMutableStringRef)mString);
if ([mString length] > 0){
*objectValue = mString;
[mString autorelease];
return YES;
}
*objectValue = @"";
[mString release];
return NO;
}
- (NSString *)stringForObjectValue:(id)objectValue
{
return objectValue;
}
@end
On Friday, April 25, 2003, at 11:07 AM, Theodore Petrosky wrote:
I have been working on an interface to a postgresql
database. part of it a client list (names, addresses,
etc). I want to limit an NSTextField so the user can
not enter a whitespace as a leading character.
However, whitespaces are permitted in the middle of an
entry.
Is this doable in a formatter or is it better to post
process the entry and remove any leading and double
spaces?
Spaces are legal characters, just not at the beginning
or end.
Currently, I am trimming the whitespace and manually
parsing the string for double spaces after the user
clicks to accept the entry.
Ted
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
_______________________________________________
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.