Java String Encode encodeStr(String str)

Here you can find the source of encodeStr(String str)

Description

encode Str

License

Open Source License

Declaration

public static final String encodeStr(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

public class Main {
    public static final String ENCODE_CHARACTERSET = "UTF-8";

    public static final String encodeStr(String str) {

        try {//from   w w w  .  j av  a  2 s .co m
            str = URLEncoder.encode(str, ENCODE_CHARACTERSET);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return str;
    }
}

Related

  1. encodePath(String path)
  2. encodePath(String str)
  3. encodeRfc5849(final String value)
  4. encodeSpecialMdxCharactersInNames(String name)
  5. encodeState(Map params)
  6. encodeStr(String str)
  7. encodeStr(String t)
  8. encodeString(final String string)
  9. encodeString(OutputStream out, String str)