To avoid a newline in multi-line strings
Nick Sabalausky
a at a.a
Sat Jul 23 20:42:58 PDT 2011
"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
news:j0g39q$dr6$1 at digitalmars.com...
> On 07/23/2011 07:40 PM, Nick Sabalausky wrote:
>> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org> wrote in message
>>> std.string.outdent
>>>
>>
>> It would make sense to name the "unindent" function "outdent", but the
>> "normalize" does more than that: It also removes all whitespace-only
>> lines
>> from the top and bottom ("stripTopBottom") and (though this part is maybe
>> far less important) it does a stripr on each remaining line.
>
> It does too much. Just have it do outdenting and call it outdent, it will
> be useful to many. "Normalized text" means several things in NLP, neither
> of which is what you mean.
>
I think it's very useful to also have a funct that does all of that, but I
agree that normalize is a bad name for it.
What do you think about having stripTop and stripBottom functions? (Ie,
Removing all white-space-only lines from the top or bottom of a string.
assert(stripTop(" \n \t \n\tA") == "\tA") ) If those are there in
addition to outdent, then a user could trivially combine them all into one
util func if they wanted.
In any case, I'll make a pull request for outdent.
More information about the Digitalmars-d
mailing list