The OpenD Programming Language

stripRight

import mir.string;
alias stripRight = scanRightAny!"!="

Examples

import mir.test: should;

"     hello world     ".stripRight(' ').should == "     hello world";
"     hello world     ".scanRightAny('w').should == "     hello w";
"     hello world     ".scanRightAny('!').should == "";
"___\t\n\thello world\n\t".stripRight('\n', '\t').should == "___\t\n\thello world";
"hello world".stripRight(' ').should == "hello world";
"           hello world".stripRight(' ').should == "           hello world";

"     hello world        _____________              "
    .stripRight(' ', '_').should == "     hello world";

Meta