Skip to content

Commit

Permalink
Str.trim-leading - more efficient than in master
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Aug 7, 2011
1 parent f27ddd0 commit b0f733e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/Str.pm
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,18 @@ my class Str does Stringy {
}
@chars.join('');
}

method trim-leading(Str:D:) {
my Int $pos = nqp::p6box_i(
pir::find_not_cclass__IiSii(
pir::const::CCLASS_WHITESPACE,
nqp::unbox_s(self),
0,
nqp::unbox_i(self.chars)
)
);
self.substr($pos);
}
}


Expand Down

0 comments on commit b0f733e

Please sign in to comment.