String.ltrim() and rtrim() methods RFE
mr at sun.com
Fri Nov 16 20:19:27 PST 2007
> Date: Fri, 16 Nov 2007 15:19:50 -0800
> From: Nick Radov <nradov at axolotl.com>
> The bug voting mechanism doesn't really work for trivial RFEs like this.
> First, the bug has been closed for a while and no one is going to vote for
> a closed bug. Second, everyone only gets a few votes so they're going to
> put their votes on the most critical issues. Annoyances like this are left
> to languish.
> Let's look at this RFE a different way. Is there any reason not to
> implement it?
Beware: In general this is not a very persuasive line of reasoning.
If all RFEs over the last ten years had been evaluated in this way then
most of them would've been implemented by now, and the platform would be
a horrid, rotting mess of woefully inconsistent spaghetti.
Having said that, I've spent quite a bit of time over the last couple of
months hacking Python code for the OpenJDK Mercurial infrastructure, and
I've used Python's equivalent lstrip/rstrip functions more than once.
They're quite handy actually, especially the rstrip function that takes
a string argument and removes any trailing characters present in that
So if somebody's going do to this I'd actually recommend adding four
methods (needed since Java doesn't have default parameter values):
Of course one can get this behavior today with the replaceFirst method,
but that requires compiling the regex and building a matcher, which is
awfully heavyweight, especially in the middle of a tight loop.
More information about the core-libs-dev