Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # WHY?
- "/foo/bar/baz".split("/")
- # => ["", "foo", "bar", "baz"]
- "/foo/bar/baz/".split("/")
- # => ["", "foo", "bar", "baz"]
- "foo/bar/baz/".split("/")
- # => ["foo", "bar", "baz"]
- # What's the best way to get this result?
- "/foo/bar/baz".split_alternative("/")
- # => ["", "foo", "bar", "baz"]
- "/foo/bar/baz/".split_alternative("/")
- # => ["", "foo", "bar", "baz", ""]
- "foo/bar/baz/".split_alternative("/")
- # => ["foo", "bar", "baz", ""]
Add Comment
Please, Sign In to add comment