Skip to content
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

String#start_with? returns false when using an empty string #1923

Closed
YorickPeterse opened this issue Aug 26, 2014 · 3 comments
Closed

String#start_with? returns false when using an empty string #1923

YorickPeterse opened this issue Aug 26, 2014 · 3 comments
Milestone

Comments

@YorickPeterse
Copy link

@YorickPeterse YorickPeterse commented Aug 26, 2014

On MRI/Rubinius the following returns true:

'hello'.start_with?('')

On JRuby 1.7.12 however this returns false. I've created a corresponding RubySpec pull request to at least add a spec for this, which can be found here: https://github.com/rubyspec/rubyspec/pull/285.

Currently some of my code relies on this behavior, though one can quite easily work around it (at least for the time being).

YorickPeterse added a commit to YorickPeterse/oga that referenced this issue Aug 26, 2014
String#start_with?() returns false on JRuby when used with an empty string. See
jruby/jruby#1923 for more information.
@subbuss
Copy link
Contributor

@subbuss subbuss commented Aug 27, 2014

FWIW, this works in 9K (jruby-head).

$ jruby -e "p 'hello'.start_with?('')"
true

@enebo enebo added this to the JRuby 1.7.14 milestone Aug 27, 2014
@enebo
Copy link
Member

@enebo enebo commented Aug 27, 2014

This works on jruby-1_7 branch (and will be in 1.7.14). I did not bother to check if this was fixed for 1.7.13 or for 1.7.14 but it can be marked back as fixed to 1.7.13 if anyone cares enough to figure that detail out.

@enebo enebo closed this Aug 27, 2014
@YorickPeterse
Copy link
Author

@YorickPeterse YorickPeterse commented Aug 27, 2014

Ah great, thanks!

@enebo enebo modified the milestones: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014
mkristian added a commit that referenced this issue Aug 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants