Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
chromatic committed Feb 15, 2010
2 parents 448a825 + 4246be2 commit ee1e518
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions src/core/Any-str.pm
Expand Up @@ -181,16 +181,29 @@ augment class Any {
(~self).split('').reverse().join;
}

# TODO: signature not fully specced in S32 yet
multi method trim() is export {
# (~self).subst(/(^\s+)|(\s+$)/, "", :g)
if self ~~ /^\s*(.*?)\s*$/ {
# Not yet spec'd, I expect it will be renamed
multi method trim-leading() is export {
if self ~~ /^\s*(\S.*)$/ {
~$/[0];
} else {
self;
}
}

# Not yet spec'd, I expect it will be renamed
multi method trim-trailing() is export {
if self ~~ /^(.*\S)\s*$/ {
~$/[0];
} else {
self;
}
}

# TODO: signature not fully specced in S32 yet
multi method trim() is export {
self.trim-leading.trim-trailing;
}

multi method words(Int $limit = *) {
self.comb( / \S+ /, $limit );
}
Expand Down
2 changes: 1 addition & 1 deletion t/spectest.data
Expand Up @@ -482,7 +482,7 @@ S32-str/split-simple2.t # CHEAT! simplified version of split-simple.t
# S32-str/split.t
# S32-str/sprintf.t
# S32-str/substr.t
# S32-str/trim.t
S32-str/trim.t
S32-str/ucfirst.t
S32-str/uc.t # icu
# S32-str/unpack.t
Expand Down

0 comments on commit ee1e518

Please sign in to comment.