Android examples for java.lang:String Split
split Last pattern
import android.text.TextUtils; public class Main{ public static String[] splitLast(String target, String pattern) { int index = target.lastIndexOf(pattern); if (index == -1) { throw new RuntimeException("Pattern is not found."); }/*w w w .j a v a 2 s. co m*/ return new String[] { target.substring(0, index), target.substring(index + 1) }; } }