Created
March 27, 2017 01:53
-
-
Save nelhage/13d160fa4d956d989862ed9c28735ddb to your computer and use it in GitHub Desktop.
split
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby -e 'puts ("".split(" ")).inspect' | |
[] | |
$ perl -MData::Dumper -E 'say Dumper([split(" ", "")])' | |
$VAR1 = []; | |
$ python -c 'print "".split(" ")' | |
[''] | |
# https://play.golang.org/p/qErK71KCsF | |
$ echo 'package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
fmt.Println(strings.Split(" ", "")) | |
} | |
' > split.go; go run split.go | |
[ ] | |
$ echo 'class Split { | |
> public static void main(String []args) { | |
> String[] bits = "".split(" "); | |
> System.out.print("["); | |
> for (String b : bits) { | |
> System.out.print("\"" + b + "\" "); | |
> } | |
> System.out.println("]"); | |
> } | |
> } | |
> ' > split.java && javac split.java && java Split | |
["" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment