package utils;
import java.io.UnsupportedEncodingException;
public class MyUtil {
public static String toUnicode(String s)
{
if(s == null || s.equals("")) {
return s="";
}
try {
s = new String(s.getBytes("iso-8859-1"),"utf-8");
//把utf-8編碼轉換為tomcat
} catch(UnsupportedEncodingException e)
{
s = ""; e.printStackTrace();
}
return s;
}
public static int toInt(String s)//字串轉整體
{
if(s == null || s.equals("")) {
s = "0";
}
int i = 0;
try {
i = Integer.parseInt(s);
}catch(Exception e)
{
i = 0;
e.printStackTrace();
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/22770.html
標籤:新技術前沿
上一篇:HiveSQL報NoViableAltException
下一篇:資料庫課程設計 社團管理系統
