请问 怎样才能得到一个字符串的编码方式? ?gb2312?b?b 代表base64编码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 经典代码: /** * 返回字符集名 */ public static String getCharSet(String eword) { if (!eword.startsWith("=?")) // not an encoded word return null; // get charset int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) return null; return javax.mail.internet.MimeUtility.javaCharset(eword.substring(start, pos)); } /** * 返回编码形式 */ public static String getEncoding(String eword) { if (!eword.startsWith("=?")) // not an encoded word return null; int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) return null; // get encoding start = pos+1; if ((pos = eword.indexOf('?', start)) == -1) return null; return eword.substring(start, pos); } Spring mvc 初级问题 fork()函数的应用 哪位大神解释一下 java 操作关于文件的读写。着急,在线等。 Spring 怎么调用存储过程? 请教关于replaceAll方法和正则表达式 请教,如何实现牌类游戏房间的建模设计 帮帮忙 全部的分求够JAVAMAIL教程下载的网址(最好的中文的)求求大家了急用 [帮助]我把resin加到windows的服务里,但是启动不了!! 如何加入包 这里有使用JMS做企业通信的吗 ----------------jdk1.3编程环境的设置问题----------------
/**
* 返回字符集名
*/
public static String getCharSet(String eword) {
if (!eword.startsWith("=?")) // not an encoded word
return null;
// get charset
int start = 2; int pos;
if ((pos = eword.indexOf('?', start)) == -1)
return null;
return javax.mail.internet.MimeUtility.javaCharset(eword.substring(start, pos));
}
/**
* 返回编码形式
*/
public static String getEncoding(String eword) {
if (!eword.startsWith("=?")) // not an encoded word
return null;
int start = 2; int pos;
if ((pos = eword.indexOf('?', start)) == -1)
return null;
// get encoding
start = pos+1;
if ((pos = eword.indexOf('?', start)) == -1)
return null;
return eword.substring(start, pos);
}