Ok, what I want to know is is there a way with Java to do what Python can do below...
string_sample = \"hello world\"
string_sample[:-1]
>>> \"hell
I have a created a simple library for that, called JavaSlice, which gives a uniform way to access slices of String, List or arrays in Java, in a similar manner as Python.
So your examples would be simply written as this:
String sample = "hello world";
System.out.println(slice(sample, 0, -1)); // "hello worl"
System.out.println(slice(sample, -1)); // 'd'
System.out.println(slice(sample, 3)); // 'l'