Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String formatImageUri(String originUri, String pre) { try { if (originUri == null) { return originUri; } String origin = originUri.replaceAll("!.*\\?", "?"); int index = origin.lastIndexOf('?'); if (index < 0) { return origin; } String p1 = origin.substring(0, index); String p2 = origin.substring(index); return p1 + pre + p2; } catch (Throwable e) { } return originUri; } }