|
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.opengion.fukurou.util.StringUtil
public final class StringUtil
StringUtil.java は、共通的に使用される String関連メソッドを集約した、クラスです。
フィールドの概要 | |
---|---|
static Charset |
DEFAULT_CHARSET
プラットフォーム依存のデフォルトの Charset です。 |
メソッドの概要 | |
---|---|
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 |
caseReplace(String target,
String caseStr,
boolean ignoreCase)
引数の AA:01 BB:02 CC:03 … 形式の、元値:新値のスペース区切り文字列を元に、 元値を新値に置き換えます。 |
static String |
code39(String value,
boolean checkDigit)
CODE39 の 文字列を作成します。 |
static int |
countChar(String value,
char ch)
文字列に含まれる、特定の文字の個数をカウントして返します。 |
static Map<String,String> |
cssParse(String cssText)
簡易CSS形式のフォーマットを、Mapにセットします。 |
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[] |
csv2ArrayExt(String csvData,
int maxNo)
カンマ(,)、ハイフン(-)で連結された String を、配列に分解して、その値を返す処理のスペシャル版です。 |
static String[] |
csv2ArrayOnly(String csvData)
区切り文字で連結された String を、配列に分解して、その値を返します。 |
static String |
csvOutQuote(String str)
文字列の前後のダブルクオートを取り外します。 |
static String |
deleteChar(String value,
char ch)
所定のキャラクタコードを取り除いた文字列を作成します。 |
static String |
deleteWhitespace(String data)
引数から空白文字を削除して返します。 |
static Object[] |
enume2Array(Enumeration<?> enume)
Enumerationから、オブジェクト配列データを返します。 |
static Object[] |
enume2Array(Enumeration<?> enume,
Object[] objs)
Enumerationから、オブジェクト配列データを返します。 |
static Color |
getColorInstance(String value)
カラーキーワードより、Colorオブジェクトを作成します。 |
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 String |
nval2(String in,
String def,
String def2)
引数 in が、null または、ゼロ文字列の場合は、デフォルト値 def を返します。 |
static String |
ogStackTrace(Throwable th)
Throwable の printStackTrace() 結果の内、opengion に関する箇所だけを文字列に変換して返します。 |
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,
String... urls)
指定のURL文字列同士を連結させます。 |
static String |
urlDecode(String value)
UTF-8 でURLエンコードされた文字列をデコードします。 |
static String |
urlEncode(String value)
UTF-8 で、URLエンコードを行います。 |
static String |
valueOf(Object obj)
Object 引数の文字列表現を返します。 |
static String |
xmlFilter(String input)
XML上のエスケープ文字を変換します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
public static final Charset DEFAULT_CHARSET
5.5.2.6 (2012/05/25) findbugs対応 |
メソッドの詳細 |
---|
public static String urlEncode(String value)
value
- エンコードする文字列
public static String urlDecode(String value)
value
- デコードする文字列
5.4.5.0 追加 |
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)
str
- 整数の Stringsu_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)
str
- 整数の Stringsu_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 caseReplace(String target, String caseStr, boolean ignoreCase)
target
- 元の文字列caseStr
- 置換リスト(AA:01 BB:02 CC:03 … 形式)。null の場合は、比較しない。ignoreCase
- true:大文字として比較 / false:そのまま比較
5.7.2.3 (2014/01/31) 新規追加 |
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[] csv2ArrayExt(String csvData, int maxNo)
csvData
- 0,1,3,5-8,10-* などのCSV-ハイフン文字列maxNo
- "*" が指定された場合の、最大数
5.5.7.2 (2012/10/09) 新規追加 |
public static String valueOf(Object obj)
obj
- 文字列表現すべき元のオブジェクト
public static String htmlFilter(String input)
input
- HTMLエスケープ前の文字列
public static String xmlFilter(String input)
input
- XMLエスケープ前の文字列
5.8.2.2 (2014/12/19) 新規作成 |
public static String quoteFilter(String input)
input
- 入力文字列
public static String deleteChar(String value, char ch)
value
- 処理対象の文字列ch
- 取り除きたいキャラクタ
public static int countChar(String value, char ch)
value
- 処理対象の文字列ch
- カウントする文字
5.2.0.0 (2010/09/01) |
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
- デフォルト文字列
5.2.2.0 (2010/11/01) "_" の取り扱い変更 |
public static String nval2(String in, String def, String def2)
in
- 基準となる文字列def
- デフォルト文字列def2
- NULL代替文字(_)の場合のデフォルト文字列
5.2.2.0 (2010/11/01) "_" の取り扱い変更 |
public static boolean isNull(String in)
in
- 基準となる文字列
public static String stringStackTrace(Throwable th)
th
- printStackTraceすべき元のThrowableオブジェクト
public static String ogStackTrace(Throwable th)
th
- 元のThrowableオブジェクト
5.7.2.0 (2014/01/10) 新規作成 |
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
- 変換元の文字列minFraction
- 変換時の少数点以下の固定桁数
4.0.0.0 (2007/10/26) 空白のトリム処理を追加 |
public static Object newInstance(String cls)
cls
- 作成するクラスのフルネーム
RuntimeException
- 何らかのエラーが発生した場合public static Object newInstance(String cls, ClassLoader loader)
cls
- 作成するクラスのフルネームloader
- 作成するクラスのクラスローダ
RuntimeException
- 何らかのエラーが発生した場合public static String urlAppend(String url1, String url2, String... urls)
url1
- 先頭URL文字列url2
- 後方URL文字列(絶対パスの場合は、返り値)urls
- 後方URL文字列
5.0.0.1 (2009/08/15) 不要なオブジェクトの生成を抑制する。 |
5.6.5.2 (2013/06/21) 第3引数を可変長引数に変更 |
public static String getUnicodeEscape(String value)
value
- 変換前の文字列
public static String getReplaceEscape(String value)
value
- HTMLのエスケープ記号(&#xZZZZ;)を含む文字列
public static double parseDouble(String value)
value
- doubleに変換する元の文字列
public static Color getColorInstance(String value)
value
- 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 String spanCut(String data)
data
- 元のString文字列
4.3.4.3 (2008/12/22) TableWriterで利用していたものを移動 |
public static Map<String,String> cssParse(String cssText)
cssText
- 簡易CSS形式のフォーマット文字列
5.6.5.2 (2013/06/21) 新規追加 |
public static String deleteWhitespace(String data)
data
- 元のString文字列
5.6.9.4 (2013/10/31) TableWriterで利用していたものを移動 |
|
openGion 5.8.3.0 | ||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |