Skip to content

Instantly share code, notes, and snippets.

@Isomorph70
Created January 17, 2021 12:53
Show Gist options
  • Save Isomorph70/6d3f3c6675d10b4287a8179f1cf534ca to your computer and use it in GitHub Desktop.
Save Isomorph70/6d3f3c6675d10b4287a8179f1cf534ca to your computer and use it in GitHub Desktop.
ruby split join error
a='/a/test'
b=a.split('/').join('/')
puts "Fail start split!!!" if a!=b
a='a/test/'
b=a.split('/').join('/')
puts "Fail end split!!!" if a!=b
@Isomorph70
Copy link
Author

split fail to make a split if the separating character is in the end, a reversal with join will not work in this situation.

ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-linux]

shs@cyonic ~/dev/triee_dir $ ruby split_join_test.rb
Fail end split!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment