Android examples for java.lang:String Replace
replace string Token With another token
import android.text.TextUtils; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.util.AbstractCollection; import java.util.Collection; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String replaceTokenWith(String originalString, String token, String replacement) { int index = originalString.indexOf(token); if (index != -1) { String ret = originalString.substring(0, index) + replacement + originalString.substring(index + token.length()); return ret; } else {/*from www . jav a2s . c o m*/ return originalString; } } }