Skip to content

Python like slicable and iterable string type in Java

aburkov edited this page Jun 27, 2015 · 1 revision

With xpresso you can use a pythonic slicable and iterable string type in Java.

import com.wantedtech.common.xpresso.types.str;

str city = x.str("New York City");

x.print(city.slice(4,8));

Console: York
x.print(city.sliceFrom(-4));

Console: City
x.print(city.sliceTo(3));

Console: New
for (String character : city)
	x.print(character);

Console: N
e
w

Y
o
r
k
Clone this wiki locally