encode Space in a string to %20 - Android java.lang

Android examples for java.lang:String Escape

Description

encode Space in a string to %20

Demo Code

import android.location.Location;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main{

    public static String encodeSpace(String s) {
        return s.replaceAll(" ", "%20");
    }//from  w  w  w .j  a  va  2s .com

}

Related Tutorials