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#split not working #3638

Open
Hanumashin opened this issue Apr 25, 2017 · 4 comments
Open

String#split not working #3638

Hanumashin opened this issue Apr 25, 2017 · 4 comments

Comments

@Hanumashin
Copy link

Hanumashin commented Apr 25, 2017

case#1
try
'12345678901234567890#123'.split('#')[0]
and get (wrong result)
'12345678901234567890#123'
but it should
'12345678901234567890'

case#2
try
'12345678901234567890#12'.split('#')[0]
and get (correct result)
'12345678901234567890'

Has anyone found this like me?
Please help.

@Hanumashin Hanumashin changed the title split not working String#split not working Apr 25, 2017
@bovi
Copy link
Member

bovi commented Apr 25, 2017

Maybe I miss something but you split at the . and in your first example you compare with a string which stoll contains the . and bot parts but in the second example you compare to only the 0 element before the .

It seems this is absolute correcy but maybe I missunderstand something. can you explain what you would expect and why?

@matz
Copy link
Member

matz commented Apr 25, 2017

I cannot reproduce the issue. Could you show us an error reproducing script?

@bovi
Copy link
Member

bovi commented Apr 25, 2017

Oh i think I got what you mean. You are saying that you apply split with '.' but the result is still a string with a .? I can't reproduce this. Do you have additional code before this bug? What are your compiling option?

img_2966

@Hanumashin
Copy link
Author

Thank you so much @bovi @matz
I will check something again then response you later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants