Ovid wrote:
$string.trim(:leading<0>); $string.trim(:trailing<0>);
>>>> Setting leading or trailing to false (they default to true) would >>>> result in either leading or trailing whitespace not being trimmed
Alternatively, those could be ltrim() and rtrim(). If you need to dynamically determine what you're going to trim, you'd couldn't just set variables to do it, though. You'd have to figure out which methods to call. Or all could be allowed and $string.trim(:leading<0>) could all $string.rtrim internally.
I like having the options, I think. If the default value of :trailing was /<ws>*/, then someone could change it to /<ws>*\#\N*/ to chomp trailing line comments. (Assuming they don't simply redefine the <ws> token)