Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix chomp on Win32, thus fixing basic-open.t.
  • Loading branch information
jnthn committed Jul 5, 2011
1 parent 2cac886 commit 3d623cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/Str.pm
Expand Up @@ -19,8 +19,11 @@ my class Str {
multi method perl(Str:D:) { "'" ~ self ~ "'" }

method chomp() {
my $idx = self.chars - 1;
self.substr($idx) eq "\n" ?? self.substr(0, $idx) !! self;
my $n_idx = self.chars - 1;
my $rn_idx = $n_idx - 1;
self.substr($rn_idx) eq "\r\n" ?? self.substr(0, $rn_idx) !!
self.substr($n_idx) eq "\n" ?? self.substr(0, $n_idx) !!
self;
}

method chop() {
Expand Down

0 comments on commit 3d623cd

Please sign in to comment.