decode String by replacing < > ' " & - Android java.lang

Android examples for java.lang:String Replace

Description

decode String by replacing < > ' " &

Demo Code

import android.text.TextUtils;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String decodeString(String strData) {
        if (strData == null) {
            return "";
        }/*from   w ww . j a  v a  2s.c o m*/
        return strData.replaceAll("&lt;", "<").replaceAll("&gt;", ">")
                .replaceAll("&apos;", "'").replaceAll("&quot;", "\"")
                .replaceAll("&amp;", "&");
    }

}

Related Tutorials