Edison Grauman Edison Grauman - 8 months ago 30
Java Question

Shorten a string to whatever is in-between colons

I have to shorten a string to what is in-between two colons. For example if the string said

hello:I am in-between:goodbye

it would result in

I am in-between


If you can assume that there are exactly two colons (:), you could just split by it:

String input = "hello:I am in-between:goodbye";
String result = input.split(":")[1];