|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectorg.seasar.util.lang.StringUtil
public abstract class StringUtil
String用のユーティリティクラスです。
| フィールドの概要 | |
|---|---|
static String |
EMPTY
空文字 ""です。 |
static String[] |
EMPTY_STRINGS
文字列型の空の配列です。 |
| コンストラクタの概要 | |
|---|---|
StringUtil()
|
|
| メソッドの概要 | |
|---|---|
static void |
appendHex(StringBuilder buf,
byte i)
文字列に、数値を16進数に変換した文字列を追加します。 |
static void |
appendHex(StringBuilder buf,
int i)
文字列に、数値を16進数に変換した文字列を追加します。 |
static String |
camelize(String s)
_記法をキャメル記法に変換します。 |
static String |
capitalize(String name)
JavaBeansの仕様にしたがってキャピタライズを行ないます。 |
static boolean |
contains(String str,
char ch)
charを含んでいるかどうか返します。 |
static boolean |
contains(String s1,
String s2)
文字列を含んでいるかどうか返します。 |
static String |
decamelize(String s)
キャメル記法を_記法に変換します。 |
static String |
decapitalize(String name)
JavaBeansの仕様にしたがってデキャピタライズを行ないます。 |
static String |
defaultString(String str)
引数の文字列を返します。 |
static String |
defaultString(String str,
String defaultStr)
引数の文字列を返します。 |
static boolean |
endsWithIgnoreCase(String target1,
String target2)
大文字小文字を無視して特定の文字で終わっているのかどうかを返します。 |
static boolean |
equals(String target1,
String target2)
文字列同士が等しいかどうか返します。 |
static boolean |
equalsIgnoreCase(String target1,
String target2)
大文字小文字を無視して文字列同士が等しいかどうか返します。 |
static boolean |
isBlank(String str)
ブランクかどうか返します。 |
static boolean |
isEmpty(String text)
文字列が nullまたは空文字列ならtrueを返します。 |
static boolean |
isNotBlank(String str)
ブランクではないかどうか返します。 |
static boolean |
isNotEmpty(String text)
文字列が nullでも空文字列でもなければtrueを返します。 |
static boolean |
isNumber(String s)
文字列が数値のみで構成されているかどうかを返します。 |
static String |
ltrim(String text)
左側の空白を削ります。 |
static String |
ltrim(String text,
String trimText)
左側の指定した文字列を削ります。 |
static String |
replace(String text,
String fromText,
String toText)
文字列を置き換えます。 |
static String |
rtrim(String text)
右側の空白を削ります。 |
static String |
rtrim(String text,
String trimText)
右側の指定した文字列を削ります。 |
static String[] |
split(String str,
String delim)
文字列を分割します。 |
static boolean |
startsWithIgnoreCase(String target1,
String target2)
大文字小文字を無視して特定の文字で始まっているのかどうかを返します。 |
static String |
substringFromLast(String str,
String separator)
文字列の最後から指定した文字列で始まっている部分より手前を返します。 |
static String |
substringToLast(String str,
String separator)
文字列の最後から指定した文字列で始まっている部分より後ろを返します。 |
static String |
toHex(byte[] bytes)
16進数の文字列に変換します。 |
static String |
toHex(int i)
intの値を16進数の文字列に変換します。 |
static String |
trimPrefix(String text,
String prefix)
プレフィックスを削ります。 |
static String |
trimSuffix(String text,
String suffix)
サフィックスを削ります。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
|---|
public static final String EMPTY
""です。
public static final String[] EMPTY_STRINGS
| コンストラクタの詳細 |
|---|
public StringUtil()
| メソッドの詳細 |
|---|
public static final boolean isEmpty(String text)
nullまたは空文字列ならtrueを返します。
text - 文字列
nullまたは空文字列ならtruepublic static final boolean isNotEmpty(String text)
nullでも空文字列でもなければtrueを返します。
text - 文字列
nullでも空文字列でもなければtrue
public static final String replace(String text,
String fromText,
String toText)
text - テキストfromText - 置き換え対象のテキストtoText - 置き換えるテキスト
public static String[] split(String str,
String delim)
str - 文字列delim - 分割するためのデリミタ
public static final String ltrim(String text)
text - テキスト
public static final String ltrim(String text,
String trimText)
text - テキストtrimText - 削るテキスト
public static final String rtrim(String text)
text - テキスト
public static final String rtrim(String text,
String trimText)
text - テキストtrimText - 削る文字列
public static final String trimSuffix(String text,
String suffix)
text - テキストsuffix - サフィックス
public static final String trimPrefix(String text,
String prefix)
text - テキストprefix - プレフィックス
public static String decapitalize(String name)
次のように使います.
StringUtil.capitalize("UserId") = "userId"
StringUtil.capitalize("ABC") = "ABC"
name - 名前
public static String capitalize(String name)
次のように使います.
StringUtil.capitalize("userId") = "UserId"
StringUtil.capitalize("ABC") = "ABC"
name - 名前
public static boolean isBlank(String str)
str - 文字列
public static boolean isNotBlank(String str)
str - 文字列
isBlank(String)
public static boolean contains(String str,
char ch)
str - 文字列ch - char
public static boolean contains(String s1,
String s2)
s1 - 文字列s2 - 比較する対象となる文字列
public static boolean equals(String target1,
String target2)
trueを返します。
target1 - 文字列1target2 - 文字列2
public static boolean equalsIgnoreCase(String target1,
String target2)
trueを返します。
target1 - 文字列1target2 - 文字列2
public static boolean endsWithIgnoreCase(String target1,
String target2)
target1 - テキストtarget2 - 比較する文字列
public static boolean startsWithIgnoreCase(String target1,
String target2)
target1 - テキストtarget2 - 比較する文字列
public static String substringFromLast(String str,
String separator)
str - 文字列separator - セパレータ
public static String substringToLast(String str,
String separator)
str - 文字列separator - セパレータ
public static String toHex(byte[] bytes)
bytes - バイトの配列
public static String toHex(int i)
i - intの値
public static void appendHex(StringBuilder buf,
byte i)
buf - 追加先の文字列i - 数値
public static void appendHex(StringBuilder buf,
int i)
buf - 追加先の文字列i - 数値public static String camelize(String s)
次のように使います.
StringUtil.camelize("USER_ID") = "UserId"
s - テキスト
public static String decamelize(String s)
次のように使います.
StringUtil.decamelize("UserId") = "USER_ID"
s - テキスト
public static boolean isNumber(String s)
s - 文字列
truepublic static String defaultString(String str)
nullだったら空文字を返します。
次のように使います.
StringUtil.defaultString(null) = ""
StringUtil.defaultString("") = ""
StringUtil.defaultString("aaa") = "aaa"
str - 文字列(null可)
nullだったら空文字を返します。
public static String defaultString(String str,
String defaultStr)
nullだったらdefaultStrを返します。
次のように使います.
StringUtil.defaultString(null, "NULL") = "NULL"
StringUtil.defaultString("", "NULL") = ""
StringUtil.defaultString("aaa", "NULL") = "aaa"
StringUtil.defaultString("aaa", null) = "aaa"
StringUtil.defaultString(null, null) = null
str - 文字列(null可)defaultStr - 引数の文字列がnullだったら返す文字列(null可)
nullだったらdefaultStr
を返します。
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||