|
@ -0,0 +1,130 @@
|
|
|
package com.yihu.jw.wechat.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.entity.util.AesEncryptUtils;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import org.hibernate.jdbc.Expectation;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2020/3/19.
|
|
|
*/
|
|
|
public class Test {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
String s ="53.68";
|
|
|
String l = "53.680";
|
|
|
if (s.equalsIgnoreCase(l)){
|
|
|
System.out.print(true);
|
|
|
}else {
|
|
|
System.out.print(false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/** 7位ascii字符,也叫作iso646-us、unicode字符集的基本拉丁块 */
|
|
|
public static final String us_ascii = "us-ascii";
|
|
|
|
|
|
/** iso 拉丁字母表 no.1,也叫作 iso-latin-1 */
|
|
|
public static final String iso_8859_1 = "iso-8859-1";
|
|
|
|
|
|
/** 8 位 ucs 转换格式 */
|
|
|
public static final String utf_8 = "utf-8";
|
|
|
|
|
|
/** 16 位 ucs 转换格式,big endian(最低地址存放高位字节)字节顺序 */
|
|
|
public static final String utf_16be = "utf-16be";
|
|
|
|
|
|
/** 16 位 ucs 转换格式,little-endian(最高地址存放低位字节)字节顺序 */
|
|
|
public static final String utf_16le = "utf-16le";
|
|
|
|
|
|
/** 16 位 ucs 转换格式,字节顺序由可选的字节顺序标记来标识 */
|
|
|
public static final String utf_16 = "utf-16";
|
|
|
|
|
|
/** 中文超大字符集 */
|
|
|
public static final String gbk = "gbk";
|
|
|
|
|
|
/**
|
|
|
* 将字符编码转换成us-ascii码
|
|
|
*/
|
|
|
public static String toascii(String str) throws UnsupportedEncodingException{
|
|
|
return changecharset(str, us_ascii);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成iso-8859-1码
|
|
|
*/
|
|
|
public static String toiso_8859_1(String str) throws UnsupportedEncodingException{
|
|
|
return changecharset(str, iso_8859_1);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成utf-8码
|
|
|
*/
|
|
|
public static String toutf_8(String str) throws UnsupportedEncodingException{
|
|
|
return changecharset(str, utf_8);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成utf-16be码
|
|
|
*/
|
|
|
public String toutf_16be(String str) throws UnsupportedEncodingException {
|
|
|
return this.changecharset(str, utf_16be);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成utf-16le码
|
|
|
*/
|
|
|
public String toutf_16le(String str) throws UnsupportedEncodingException{
|
|
|
return this.changecharset(str, utf_16le);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成utf-16码
|
|
|
*/
|
|
|
public String toutf_16(String str) throws UnsupportedEncodingException{
|
|
|
return this.changecharset(str, utf_16);
|
|
|
}
|
|
|
/**
|
|
|
* 将字符编码转换成gbk码
|
|
|
*/
|
|
|
public static String togbk(String str) throws UnsupportedEncodingException{
|
|
|
return changecharset(str, gbk);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 字符串编码转换的实现方法
|
|
|
* @param str 待转换编码的字符串
|
|
|
* @param newcharset 目标编码
|
|
|
* @return
|
|
|
* @throws Expectation
|
|
|
*/
|
|
|
public static String changecharset(String str, String newcharset)
|
|
|
throws UnsupportedEncodingException {
|
|
|
if (str != null) {
|
|
|
//用默认字符编码解码字符串。
|
|
|
byte[] bs = str.getBytes();
|
|
|
//用新的字符编码生成字符串
|
|
|
return new String(bs, newcharset);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
/**
|
|
|
* 字符串编码转换的实现方法
|
|
|
* @param str 待转换编码的字符串
|
|
|
* @param oldcharset 原编码
|
|
|
* @param newcharset 目标编码
|
|
|
* @return
|
|
|
* @throws
|
|
|
*/
|
|
|
public static String changecharset(String str, String oldcharset, String newcharset)
|
|
|
throws Exception {
|
|
|
if (str != null) {
|
|
|
//用旧的字符编码解码字符串。解码可能会出现异常。
|
|
|
byte[] bs = str.getBytes(oldcharset);
|
|
|
//用新的字符编码生成字符串
|
|
|
return new String(bs, newcharset);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|