Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; public class Main { public static String getLastwords(String srcText, String p) { try { String[] array = TextUtils.split(srcText, p); int index = (array.length - 1 < 0) ? 0 : array.length - 1; return array[index]; } catch (Exception e) { e.printStackTrace(); } return null; } }