|
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.opengion.fukurou.util.StringUtil
public final class StringUtil
StringUtil.java は、共通的に使用される String関連メソッドを集約した、クラスです。 全変数は、public static final 宣言されており、全メソッドは、public static synchronized 宣言されています。
メソッドの概要 | |
---|---|
static String |
array2csv(String[] array)
String型の配列から、カンマ(,)で連結されたString を作成します。 |
static String |
array2line(String[] array,
String separator)
String型の配列から、セパレーターで連結されたString を作成します。 |
static String |
array2line(String[] array,
String separator,
int start)
String型の配列から、セパレーターで連結されたString を作成します。 |
static String |
code39(String value,
boolean checkDigit)
CODE39 の 文字列を作成します。 |
static String[] |
csv2Array(String csvData)
カンマ(,)で連結された String を、配列に分解して、その値を返します。 |
static String[] |
csv2Array(String csvData,
char separator)
区切り文字で連結された String を、配列に分解して、その値を返します。 |
static String[] |
csv2Array(String csvData,
char separator,
int len)
区切り文字で連結された String を、配列に分解して、その値を返します。 |
static String[] |
csv2ArrayOnly(String csvData)
区切り文字で連結された String を、配列に分解して、その値を返します。 |
static String |
csvOutQuote(String str)
文字列の前後のダブルクオートを取り外します。 |
static String |
deleteChar(String value,
char ch)
所定のキャラクタコードを取り除いた文字列を作成します。 |
static Object[] |
enume2Array(Enumeration<?> enume)
Enumerationから、オブジェクト配列データを返します。 |
static Object[] |
enume2Array(Enumeration<?> enume,
Object[] objs)
Enumerationから、オブジェクト配列データを返します。 |
static Color |
getColorInstance(String value)
カラーキーワードより、Colorオブジェクトを作成します。 |
static String |
getMD5(String input)
MessageDigestにより、MD5 でハッシュした文字に変換します。 |
static NativeType |
getNativeType(String str)
引数に指定された文字列のNativeタイプを返します。 |
static String |
getReplaceEscape(String value)
HTML のエスケープ記号(&#xZZZZ;)をUnicode文字列に戻します。 |
static String |
getUnicodeEscape(String value)
Unicode文字列の値を HTML のエスケープ記号(&#xZZZZ;)に変換します。 |
static String |
htmlFilter(String input)
HTML上のエスケープ文字を変換します。 |
static String |
intFill(String str,
int su_fill)
整数のフォーム( 12 で、整数部 12桁を表す)に合った新しい文字列を作り、それを返します。 |
static boolean |
isNull(String in)
引数 in が、null または、ゼロ文字列、またはすべて空白文字の場合は、true を返します。 |
static String |
iterator2line(Iterator<?> ite,
String separator)
Iteratorから、セパレーターで連結されたString を作成します。 |
static String |
lTrim0(String in)
文字列の前方のゼロ(0)を削除します。 |
static byte[] |
makeByte(String value,
String encode)
指定の文字列をバイトコードに変換します。 |
static String |
makeString(byte[] byteValue,
int start,
int length,
String encode)
内部で使われる byte[] から String 生成 メソッド |
static Object |
newInstance(String cls)
識別id に応じた オブジェクトを作成します。 |
static Object |
newInstance(String cls,
ClassLoader loader)
指定されたクラスローダを使って、識別id に応じた オブジェクトを作成します。 |
static String |
numberFormat(String in,
int minFraction)
大きな浮動小数点数について、カンマ編集を行います。 |
static boolean |
nval(String in,
boolean def)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static int |
nval(String in,
int def)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static long |
nval(String in,
long def)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static String |
nval(String in,
String def)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static String |
nval2(String in,
String def)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static double |
parseDouble(String value)
文字列をdoubleに変換します。 |
static String |
quoteFilter(String input)
JavaScript 等の引数でのクオート文字をASCII変換します。 |
static String |
realFill(String str,
double su_fill)
小数点のフォームに合った新しい文字列を作り、文字列を返します。 |
static String |
replace(String target,
String from,
String to)
ストリングの部分文字列を,別の文字列に置換えたストリングを返します。 |
static String |
rTrim(String str)
文字列の後ろのスペースを削除します。 |
static String[] |
rTrims(String[] str)
文字列配列の各要素の後ろのスペースを削除します。 |
static String |
spanCut(String data)
引数からspanタグを取り除いて返します。 |
static String |
stringFill(String str,
int su_fill,
String encode)
半角スペースで固定長(半角換算の数)に変換した文字列を返します。 |
static String |
stringKFill(String str,
int su_fill,
String encode)
全角スペースで固定長(半角換算の数)に変換した文字列を返します。 |
static String |
stringStackTrace(Throwable th)
Throwable の printStackTrace() 結果を文字列に変換して返します。 |
static String |
stringXFill(String str,
int su_fill)
半角スペースで固定長(半角換算の数)に変換した文字列を返します。 |
static String |
toNumber(String str)
文字列の後ろから、" .0" の文字を削除した数字型文字列を返します。 |
static String |
urlAppend(String url1,
String url2)
指定のURL文字列同士を連結させます。 |
static String |
urlEncode(String value)
UTF-8 で、URLエンコードを行います。 |
static String |
valueOf(Object obj)
Object 引数の文字列表現を返します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
メソッドの詳細 |
---|
public static String urlEncode(String value)
value
- エンコードする文字列
public static String rTrim(String str)
str
- 元の文字列
public static String toNumber(String str)
str
- 元の文字列
3.8.8.1 (2007/01/10) 新規作成 |
public static String lTrim0(String in)
in
- 元の文字列
3.5.4.5 (2004/01/23) 新規追加 |
public static String[] rTrims(String[] str)
str
- 元の文字列
public static String csvOutQuote(String str)
str
- 元の文字列
public static String makeString(byte[] byteValue, int start, int length, String encode)
byteValue
- 変換するバイト列start
- 変換開始アドレスlength
- 変換バイト数encode
- 変換する文字エンコード
public static byte[] makeByte(String value, String encode)
value
- 変換するストリング値encode
- 変換する文字エンコード
public static String stringXFill(String str, int su_fill)
str
- Fill埋めする文字列su_fill
- Fill埋めする文字列の長さ。(半角換算の数)
public static String stringFill(String str, int su_fill, String encode)
str
- Fill埋めする文字列su_fill
- Fill埋めする文字列の長さ。(半角換算の数)encode
- Fill埋めする文字列の文字エンコード
public static String intFill(String str, int su_fill)
su_fill
- フォームを表す数字 ( 12 で、整数部 12桁を表す)
public static String stringKFill(String str, int su_fill, String encode)
str
- Fill埋めする文字列su_fill
- Fill埋めする文字列の長さ。(半角換算の数)encode
- Fill埋めする文字列の文字エンコード
public static String realFill(String str, double su_fill)
su_fill
- フォームを表す実数 ( 12.4 で、整数部 12桁、小数部 4桁 計17桁 )
public static String replace(String target, String from, String to)
target
- 元の文字列from
- 置換元部分文字列to
- 置換先部分文字列
5.0.0.1 (2009/08/15) 不要なオブジェクトの生成を抑制する。 |
public static String array2csv(String[] array)
array
- 元の文字列配列
public static String array2line(String[] array, String separator)
array
- 元の文字列配列separator
- 区切り記号
public static String array2line(String[] array, String separator, int start)
array
- 元の文字列配列separator
- 区切り記号start
- 配列の連結開始アドレス
public static Object[] enume2Array(Enumeration<?> enume)
enume
- 元のEnumeration
public static Object[] enume2Array(Enumeration<?> enume, Object[] objs)
enume
- 元のEnumerationobjs
- - 配列が十分な大きさを持つ場合は、Vector の要素が格納される配列。
そうでない場合は、要素を格納するために同じ実行時の型の新しい配列が割り当てられる
public static String iterator2line(Iterator<?> ite, String separator)
ite
- 元のIteratorseparator
- 区切り記号
public static String[] csv2Array(String csvData)
csvData
- 元のデータ
public static String[] csv2Array(String csvData, char separator)
csvData
- 元のデータseparator
- 区切り文字
public static String[] csv2Array(String csvData, char separator, int len)
csvData
- 元のデータseparator
- 区切り文字len
- 指定の長さの配列で返します。
3.8.5.1 (2006/05/08) 設定配列の数を指定できるように変更 |
3.8.8.2 (2007/01/26) 分割後の値の前後のスペースは削除します。 |
public static String[] csv2ArrayOnly(String csvData)
csvData
- 元のデータ
public static String valueOf(Object obj)
obj
- Object
public static String htmlFilter(String input)
input
- HTMLエスケープ前の文字列
public static String quoteFilter(String input)
JavaScript 等の引数でのクオート文字をASCII変換します。
JavaScript の引数の値に、ダブルクオート(")、シングルクオート(')が 含まれると、文字列を表す為に前後に指定しているクオートと混乱し、 データを表現できないケースがあります。その場合には、クオート文字を ASCII文字に置き換える事で、指定の文字を渡すことが可能になります。 ここでは、引数文字列に、ダブルクオート(")、シングルクオート(')が、 含まれると、それぞれ、ASCII コード(¥x22、¥x27)に置き換えます。 なお、null は、ゼロ文字列に変換して返します。
input
- 入力文字列
public static String getMD5(String input)
input
- 変換前の文字列
public static String deleteChar(String value, char ch)
value
- 処理対象の文字列ch
- 取り除きたいキャラクタ
public static String code39(String value, boolean checkDigit)
value
- 処理対象の文字列checkDigit
- チェックデジットの付与(true:付ける/false:付けない)
public static String nval(String in, String def)
in
- 基準となる文字列def
- デフォルト文字列
public static int nval(String in, int def)
in
- 基準となる文字列def
- デフォルト数字
public static long nval(String in, long def)
in
- 基準となる文字列def
- デフォルト数字
public static boolean nval(String in, boolean def)
in
- 基準となる文字列def
- デフォルト論理値
public static String nval2(String in, String def)
in
- 基準となる文字列def
- デフォルト文字列
public static boolean isNull(String in)
in
- 基準となる文字列
public static String stringStackTrace(Throwable th)
th
- Throwable
public static String numberFormat(String in, int minFraction)
DecimalFormat format = new DecimalFormat( "#,##0.00########" ); double dd = Double.parseDouble( val ); return format.format( dd );に対して、minFraction分の少数以下のゼロの指定と、inに ',' が 含まれた処理を追加した感じになります。
in
- String 変換元の文字列minFraction
- int 変換時の少数点以下の固定桁数
4.0.0.0 (2007/10/26) 空白のトリム処理を追加 |
public static Object newInstance(String cls)
cls
- 作成するクラスのフルネーム
RuntimeException
- 何らかのエラーが発生した場合public static Object newInstance(String cls, ClassLoader loader)
cls
- String 作成するクラスのフルネームloader
- ClassLoader 作成するクラスのクラスローダ
RuntimeException
- 何らかのエラーが発生した場合public static String urlAppend(String url1, String url2)
url1
- 先頭URL文字列url2
- 後方URL文字列(絶対パスの場合は、返り値)
5.0.0.1 (2009/08/15) 不要なオブジェクトの生成を抑制する。 |
public static String getUnicodeEscape(String value)
value
- 変換前の文字列
public static String getReplaceEscape(String value)
value
- String HTML のエスケープ記号(&#xZZZZ;)を含む文字列
public static double parseDouble(String value)
value
- String doubleに変換する元の文字列
public static Color getColorInstance(String value)
カラーキーワードより、Colorオブジェクトを作成します。
指定文字列は、java.awt.Color クラスのstatic フィールド名で指定します。 BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY , MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , PURPLE が指定できます。 また、先頭に、# を付ける事で、#XXXXXX形式の16bitRGB表記 でも指定可能です。 static フィールド名のMapを管理していますが、存在しない場合は、エラーになります。
value
- String java.awt.Color フィールドを示す文字列または、#XXXXXX形式の16bitRGB表記
Color.BLACK
3.8.9.1 (2007/06/29) 新規作成 |
4.1.1.0 (2008/02/04) CLR_MAP に存在しない場合はエラーにします。 |
public static NativeType getNativeType(String str)
引数に指定された文字列のNativeタイプを返します。
1.STRING -> 数値以外の文字列(先頭の'-'、または任意の場所の'.'を除く)が含まれていた場合 2.DOUBLE -> 1以外で'.'が含まれている場合 3.INT -> 1,2以外
str
- チェックを行う文字列
NativeType
public static String spanCut(String data)
引数からspanタグを取り除いて返します。
引数が、<span ・・・>XXXX</span>形式の場合、XXXX のみ出力します。
data
- 元のString文字列
4.3.4.3 (2008/12/22) TableWriterで利用していたものを移動 |
|
openGion 5.1.3.0 | ||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |