Skip to content

Commit

Permalink
Fix shortcomings in the previous trim-leading and trim-trailing imple…
Browse files Browse the repository at this point in the history
…mentations.
  • Loading branch information
colomon committed Feb 16, 2010
1 parent ee1e518 commit f483b59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/Any-str.pm
Expand Up @@ -183,7 +183,7 @@ augment class Any {

# Not yet spec'd, I expect it will be renamed
multi method trim-leading() is export {
if self ~~ /^\s*(\S.*)$/ {
if self ~~ /^\s*:(.*)$/ {
~$/[0];
} else {
self;
Expand All @@ -194,7 +194,10 @@ augment class Any {
multi method trim-trailing() is export {
if self ~~ /^(.*\S)\s*$/ {
~$/[0];
} else {
} elsif self ~~ /^\s*$/ {
"";
}
else {
self;
}
}
Expand Down

0 comments on commit f483b59

Please sign in to comment.