Try it: http://try.kotlinlang.org/#/UserProjects/qqncr5tl9hc2a1sjt3qnh29n37/105sltrijnh63n5f7ago6fnosl
Ben.kt
-> regular code, focus on readabilty
B.kt
-> small code, but still readable
BFunKTional.kt
-> small code, functional
Example.kt
-> Parse benString and encode it again!
Results:
i42e -> 42
i0e -> 0
i-42e -> -42
4:spam -> spam
3:bar -> bar
3:foo -> foo
l4:spami42ee -> [spam, 42]
d3:bar4:spam3:fooi42ee -> {bar=spam, foo=42}