Skip to content

Instantly share code, notes, and snippets.

@narqo
Created July 1, 2017 11:30
Show Gist options
  • Save narqo/fa7394f127004b964f7da42ffe604388 to your computer and use it in GitHub Desktop.
Save narqo/fa7394f127004b964f7da42ffe604388 to your computer and use it in GitHub Desktop.
How string's split works across the languages
% node -p '",,,1,,,".split(",")'
< [ '', '', '', '1', '', '', '' ]
% python -c 'a = ",,,1,,,".split(","); print(a);'
< ['', '', '', '1', '', '', '']
//go
import ("log"; "strings")
a := strings.Split(",,,1,,,", ",")
log.Printf("%q", a)
< ["" "" "" "1" "" "" ""]
% perl -e 'use Data::Dumper; my $a = [ split(",", ",,,1,,,") ] ; print Dumper $a'
< $VAR1 = ['', '', '', '1']; // because FUCK YOU!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment