I like #2.

A clarification please: I do not see why any isWhitespace methods are needed
since the isBlank methods trim()'s their arguments.

isBlank(null) returns true
isWS(null) returns true

isBlank("") returns true
isWS("") returns true

isBlank(" ") returns true
isWS(" ") returns true

isBlank("\t\n") returns true
isWS("\t\n") returns true

isBlank(" Hello ") returns false
isWS(" Hello ") returns false

Am I missing something?

Thanks,
Gary

-----Original Message-----
From: Stephen Colebourne [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 15:33
To: Jakarta Commons Developers List
Subject: [lang] Proposal (2): isEmpty

Proposal for methods:

- isEmpty() - true for "" or null
- isNotEmpty() - opposite
- isEmptyNN() - true for ""

- isBlank() - trims - true for "  ", "" or null
- isNotBlank() - opposite
- isBlankNN() - trims - true for "  " or ""

- isWhitespace() - true for all whitespace, "" or null
- isNotWhitespace() - opposite
- isWhitespaceNN() - true for all whitespace or ""

Where NN means NotNull.
This covers all the cases, and takes the working premise that more people
want null to be true than false.


Proposal for location:
1) In StringUtils. Incompatable change to isEmpty() (no longer trims) and
isWhitespace() (null now true).

2) In StringTests (new class). Deprecate StringUtils isEmpty/isNotEmpty.


I prefer the incompatable change #1. We are offering a simply named
alternative. Also, some people already don't expect isEmpty to trim. And
Tapestry and Turbine should both be OK.

Stephen

PS. If no agreement is forthcoming, then we shall have to revert to the 1.0
methods in order to get a release.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to