編碼轉換工具類

2021-10-09 22:23:43 字數 1604 閱讀 5985

工具類:

/**

* 編碼轉換工具類

* @author zql

* @createtime 2020-11-30 22:10:12

* @version 1.1

* @modifylog 1.1 優化**

* */

public

class

unicodedecoderutil

else

}return tmp.

tostring()

;}/** * 解碼字串

* @author zql

* @createtime 2020-11-30 22:11:01

** @param hexstr

* @return

*/public

static string unescape

(string hexstr)

else

else}}

return tmp.

tostring()

;}/** * 十六進製制的編碼轉成十進位制的編碼

* @author zql

* @createtime 2020-11-30 22:11:22

** @param hexstr

* @return

*/public

static string unescapehextodec

(string hexstr)

else

else}}

return tmp.

tostring()

;}/** * 十進位制的編碼轉成十六進製制的編碼

* @author zql

* @createtime 2020-11-30 22:11:36

** @param decstr

* @return

*/public

static string unescapedectohex

(string decstr)

else

else}}

return tmp.

tostring()

;}}

測試類:

package test.junit;

import org.junit.test;

/** * 編碼轉換工具測試類

* @author zql

* @createtime 2020-11-30 22:10:12

* @version 1.1

* @modifylog 1.1 優化**

* */

public

class

unicodedecoderutiltest

@test

public

void

unescape()

@test

public

void

unescapehextodec()

@test

public

void

unescapedectohex()

}

檔案編碼轉換工具

1.起因 工作需要 原始碼是utf 8編碼的檔案,載入到vs中後無法編譯,需要轉換成gbk gb2312 編碼格式的檔案 2.實現 使用python簡單的實現了資料夾內遍歷修改檔案編碼格式 import chardet import os def strjudgecode str return ch...

日期轉換工具類

都是一些比較常用的日期工具類 public final class dateutils 取得ap系統時間。return ap系統時間 public static date getsystemdate 取得ap系統時間,不包括時分秒。return ap系統時間 public static date g...

型別轉換工具類

做專案的時候自己封裝的工具類,方便查詢,放到這裡 public class convertutil inttostring int轉string author lelonta param i return public static string inttostr int i dubtobigdec...