Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.regex.Pattern; public class Main { private final static Pattern PATTERN_PLUS = Pattern.compile("\\+"); public static String replacePlusWithPercent20(String url) { if (url.contains("+")) { url = PATTERN_PLUS.matcher(url).replaceAll("%20"); } return url; } }