?? zenkakuutil.java
字號:
/**
* IgaLib -> String
* Copyright (C) 2001 Tosiki IGA , IgaLib project member
* (http://homepage2.nifty.com/igat/igapyon/index.html)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package jp.ne.nifty.iga.tosiki.string;
import java.io.*;
/**
* 慡妏暥帤楍偵娭偡傞儐乕僥傿儕僥傿僋儔僗 <BR>
*
* Java尵岅傗JDBC僪儔僀僶偼偦傕偦傕偼墷暷偱奐敪偝傟偰偒偨傕偺側偺偱丄
* 擔杮岅(摿偵僟僽儖僶僀僩暥帤)偺憖嶌娭學偑嬯庤側応崌偑偁傝傑偡<BR>
* 偙偺僋儔僗偼 偦偺傛偆側 擔杮岅丄摿偵慡妏暥帤偵傑偮傢傞暥帤憖嶌
* 偵傑偮傢傞儊僜僢僪傪廤傔偨僋儔僗偱偡丅
*
* @author Tosiki IGA
*/
public class ZenkakuUtil
{
/**
* 梌偊傜傟偨暥帤楍傪慡妏暥帤楍壔偟傑偡丅
*
* @param String strSource 擖椡暥帤楍
* @return String 慡妏壔偝傟偨弌椡暥帤楍
*/
public static final String toZenkaku(String strSource)
{
try{
ZenkakuReader reader=new ZenkakuReader(new StringReader(strSource));
StringWriter writer=new StringWriter();
for(;;)
{
int iRead=reader.read();
if(iRead<0)
{
break;
}
writer.write(iRead);
}
reader.close();
writer.flush();
writer.close();
return writer.toString();
}catch(IOException ex){
System.out.println(ex.toString());
ex.printStackTrace();
return null;
}
}
/**
* 梌偊傜傟偨暥帤楍偺偆偪敿妏僇僞僇僫傪慡妏暥帤楍壔偟傑偡丅
*
* @param String strSource 擖椡暥帤楍
* @return String 慡妏壔偝傟偨弌椡暥帤楍
*/
public static final String toKatakanaZenkaku(String strSource)
{
try{
KatakanaZenkakuReader reader=new KatakanaZenkakuReader(new StringReader(strSource));
StringWriter writer=new StringWriter();
for(;;)
{
int iRead=reader.read();
if(iRead<0)
{
break;
}
writer.write(iRead);
}
reader.close();
writer.flush();
writer.close();
return writer.toString();
}catch(IOException ex){
System.out.println(ex.toString());
ex.printStackTrace();
return null;
}
}
/**
* 梌偊傜傟偨暥帤楍偺偆偪敿妏僇僞僇僫傪慡妏暥帤楍壔偟丄慡妏ASCII傪敿妏暥帤楍壔偟傑偡丅
*
* @param String strSource 擖椡暥帤楍
* @return String 慡妏壔偝傟偨弌椡暥帤楍
*/
public static final String normalizeZenkaku(String strSource)
{
if(strSource==null)return null;
try{
NormalizeZenkakuReader reader=new NormalizeZenkakuReader(new StringReader(strSource));
StringWriter writer=new StringWriter();
for(;;)
{
int iRead=reader.read();
if(iRead<0)
{
break;
}
writer.write(iRead);
}
reader.close();
writer.flush();
writer.close();
return writer.toString();
}catch(IOException ex){
System.out.println(ex.toString());
ex.printStackTrace();
return null;
}
}
/**
* 梌偊傜傟偨暥帤楍傪壜擻側尷傝悢帤壔偟傑偡丅<BR>
* 偙偺儊僜僢僪偼敿妏悢帤偲慡妏悢帤偑桳岠偱偡丅
*
* @param String strInput 擖椡暥帤楍
* @return int 拪弌偝傟偨悢帤
*/
public static final int toInteger(String strInput)
{
return MojiUtil.toInteger(normalizeZenkaku(strInput));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -