src/main/java/me/codeboy/common/base/net/util/CBParam.java
public static String paramsToString(String charset, Map<String, String> params) {
        StringBuffer sb = new StringBuffer();
        try {
            for (Map.Entry<String, String> item : params.entrySet()) {
                sb.append("&");
                sb.append(URLEncoder.encode(item.getKey(), charset));
                sb.append("=");
                sb.append(URLEncoder.encode(item.getValue(), charset));
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return sb.substring(1);
    }
public static String paramsToString(String charset, Map<String, String> params) {
        StringBuffer sb = new StringBuffer();
        try {
            for (Map.Entry<String, String> item : params.entrySet()) {
                sb.append("&");
                sb.append(URLEncoder.encode(item.getKey(), charset));
                sb.append("=");
                sb.append(URLEncoder.encode(item.getValue(), charset));
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return sb.substring(1);
    }
public static String paramsToString ( String charset , Map < String , String > params ) { StringBuffer sb = new StringBuffer ( ) ; try { for ( Map . Entry < String , String > item : params . entrySet ( ) ) { sb . append ( "&" ) ; sb . append ( URLEncoder . encode ( item . getKey ( ) , charset ) ) ; sb . append ( "=" ) ; sb . append ( URLEncoder . encode ( item . getValue ( ) , charset ) ) ; } } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } return sb . substring ( 1 ) ; }
convert parameters to string

@param charset
编码
@param params
parameter
@return 拼接后的字符串
convert parameters to string