クラス org.objectweb.cjdbc.common.util.Strings

すべてのメンバ一覧

説明

This class provides utilities for Strings manipulation.

作者:
Emmanuel Cecchet
バージョン:
1.0

Strings.java33 行で定義されています。

Static Public メソッド

String replace (String sourceString, String replace, String with)
String replaceCasePreserving (String sourceString, String replace, String with)


メソッド

String org.objectweb.cjdbc.common.util.Strings.replace String  sourceString,
String  replace,
String  with
[static]
 

Replaces all occurrences of a String within another String.

引数:
sourceString source String
replace text pattern to replace
with replacement text
戻り値:
the text with any replacements processed, null if null String input
Strings.java45 行で定義されています。
00046 { 00047 if (sourceString == null || replace == null || with == null 00048 || "".equals(replace)) 00049 { 00050 return sourceString; 00051 } 00052 00053 StringBuffer buf = new StringBuffer(sourceString.length()); 00054 int start = 0, end = 0; 00055 while ((end = sourceString.indexOf(replace, start)) != -1) 00056 { 00057 buf.append(sourceString.substring(start, end)).append(with); 00058 start = end + replace.length(); 00059 } 00060 buf.append(sourceString.substring(start)); 00061 return buf.toString(); 00062 }

String org.objectweb.cjdbc.common.util.Strings.replaceCasePreserving String  sourceString,
String  replace,
String  with
[static]
 

Replaces all occurrences of a String within another String. The String to be replaced will be replaced ignoring cases, all other cases are preserved in the returned string

引数:
sourceString source String
replace text to replace, case insensitive
with replacement text
戻り値:
the text with any replacements processed, null if null String input
Strings.java75 行で定義されています。
00077 { 00078 if (sourceString == null || replace == null || with == null) 00079 { 00080 return sourceString; 00081 } 00082 String lower = sourceString.toLowerCase(); 00083 int shift = 0; 00084 int idx = lower.indexOf(replace); 00085 int length = replace.length(); 00086 StringBuffer resultString = new StringBuffer(sourceString); 00087 do 00088 { 00089 resultString = resultString.replace(idx + shift, idx + shift + length, 00090 with); 00091 shift += with.length() - length; 00092 idx = lower.indexOf(with, idx + length); 00093 } 00094 while (idx > 0); 00095 00096 return resultString.toString(); 00097 }


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:19 2004に生成されました。 doxygen 1.3.8