New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.split doesn't include an empty string before a first literal zero-length string in Rakudo #2759
Comments
From @masak<sisar> n: my $a = 'abc'; my @rray = $a.split(''); say @rray[0]; say @rray[1]; |
From @kylehaI've added a test in S32-str/split-simple.t |
The RT System itself - Status changed from 'new' to 'open' |
From @cokeOn Mon May 14 08:26:13 2012, KyleHa wrote:
Here's a patch: Inline Patchdiff --git a/src/core/Str.pm b/src/core/Str.pm
index c81f371..629d2ae 100644
--- a/src/core/Str.pm
+++ b/src/core/Str.pm
@@ -719,7 +719,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $done = 0;
if $match-string eq "" {
my $chars = self.chars;
- map {
+ ("", (map {
last if $done;
if --$chars and --$l {
@@ -729,7 +729,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
$done = 1;
self.substr($c);
}
- }, 1 .. $l;
+ }, 1 .. $l
+ ), "").flat
+
}
else {
my $width = $match-string.chars;
|
1 similar comment
From @cokeOn Mon May 14 08:26:13 2012, KyleHa wrote:
Here's a patch: Inline Patchdiff --git a/src/core/Str.pm b/src/core/Str.pm
index c81f371..629d2ae 100644
--- a/src/core/Str.pm
+++ b/src/core/Str.pm
@@ -719,7 +719,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $done = 0;
if $match-string eq "" {
my $chars = self.chars;
- map {
+ ("", (map {
last if $done;
if --$chars and --$l {
@@ -729,7 +729,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
$done = 1;
self.substr($c);
}
- }, 1 .. $l;
+ }, 1 .. $l
+ ), "").flat
+
}
else {
my $width = $match-string.chars;
|
From @perlpilotUnfortunately, this patch does not work with the $limit parameter specified. But ... Fixed in rakudo/rakudo@4b5e196 -Scott On Sat Mar 29 14:23:40 2014, coke wrote:
-- |
@perlpilot - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#112868 (status was 'resolved')
Searchable as RT112868$
The text was updated successfully, but these errors were encountered: