However, this doesn't solve your problem. I think your suggestion would be useful, but I'm not sure about a name either.
Gary Gregory wrote:
No takers on discussing this one?
Gary
-----Original Message----- From: Gary Gregory [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 11:43 To: 'Jakarta Commons Developers List' Subject: [lang] StringUtils.substringAfter()
Hello,
I find the current behavior of StringUtils.substringAfter() not quite right for my needs. For example, I want to strip the leading 'www.' in a host string. If the search string is not there, the empty string is returned, which force me to write:
String host = ... String strippedHost = StringUtils.substringAfter(host, "www."); if (StringUtils.isEmpty(strippedHost)) { strippedHost = host; } //continue with stripped host.
Instead of:
String host = ... String host = StringUtils.substringAfter(host, "www."); //continue with stripped host.
If the API returned the its argument instead of "".
You'd think stripStart would do this but stripStart works on a character set, not a string prefix.
So:
(1) I do not thing that changing the current API is nice.
(2) Does this case warrant a new API? Or is this case really unusual? New API: stripStartString(String, String) Perhaps rename (deprecate etc) startStart to startStartCharSet?
Thanks, Gary
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
