On 2021-03-26 5:53 p.m., B. Estrade wrote: > Just replying to the latest, not necessarily this post. But I think it is > reasonable to consider the precedent set by chomp(). In the GH thread, it seemed > there was some confusion that trim was going to provide just the trim'ing of > *leading* white space. I think this is a reasonable assumption that it was > completing the corollary of chomp. > > I think it is reasonable "trim" does "chomp + trim leading white space" which is > a common idiom - perhaps vulgar, but an idiom nonetheless. The fact that trim > returns the value rather than affecting the value itself - an idiom we're used > to via passing data by reference - is *surprising*. I believe it completely mis-characterizes "chomp" to treat "trim" as being "chomp + trim leading white space". The chomp(), like chop(), is very narrowly focused on removing a trailing line break, and is not about removing trailing whitespace generally, which trim() is explicitly all about. A most common use case of trim() is to clean up user input where they may have typed or pasted spaces before or after their main input in some form input field or such. -- Darren DuncanThread Previous | Thread Next