|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.TextUtil
public class TextUtil
Provides some general text search and replace utilities. All methods are static.
| Constructor Summary | |
|---|---|
TextUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
characterMatches(boolean ignoreCase,
char c1,
char c2)
Returns true if the character c1 matches character c2, ignoring case (as much as is provided by Java) if the boolean ignoreCase is true. |
static String |
gsub(String src,
String srch,
String repl,
boolean ignoreCase)
Replace all (non-overlapping) occurrences of a String srch
in String src by replacement repl. |
static int |
indexOf(boolean ignoreCase,
String source,
String substring,
int fromIndex)
Returns the index within String source of the first occurrence of the specified substring, starting at the specified index. |
static int |
indexOfIgnoreCase(String str,
String substring)
Returns the index within String str of the first occurrence of the specified substring, ignoring case. |
static int |
indexOfIgnoreCase(String str,
String substring,
int fromIndex)
Returns the index within String str of the first occurrence of the specified substring, ignoring case, and starting at the specified index. |
static String |
oldGsub(String src,
String srch,
String repl,
boolean ignoreCase)
Replace all (non-overlapping) occurrences of a String srch in String
src by replacement repl. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextUtil()
| Method Detail |
|---|
public static final int indexOfIgnoreCase(String str,
String substring)
(This will likely be rewritten at some point with an actual character-by-character implementation; due to internationalization considerations this is quite a bit more difficult than a simple character match so we're currently just relying on Java's i18n features.)
str - the source String.substring - the substring to search for.
-1 is returned.
public static final int indexOfIgnoreCase(String str,
String substring,
int fromIndex)
str - any String.substring - the substring to search for.fromIndex - the index to start the search from.
fromIndex, then the index
of the first character of the first such substring is returned. If it
does not occur as a substring starting at fromIndex or
beyond, -1 is returned.
public static int indexOf(boolean ignoreCase,
String source,
String substring,
int fromIndex)
Also, as with java.lang.String's indexOf() method, there is no restriction on the value of fromIndex: if it exceeds either start or end boundary, it is set to that boundary.
source - the String to search within.substring - the substring to search for.fromIndex - the index to start the search from.
NullPointerException - if source is null
public static boolean characterMatches(boolean ignoreCase,
char c1,
char c2)
public static final String gsub(String src,
String srch,
String repl,
boolean ignoreCase)
srch
in String src by replacement repl. If the
pattern isn't found, the String is returned unchanged. A null source
String returns null.
src - any String.srch - the String to search for.repl - the replacement String.ignoreCase - a boolean determining case sensitivity of matches.
public static final String oldGsub(String src,
String srch,
String repl,
boolean ignoreCase)
srch in String
src by replacement repl. If the pattern isn't found,
the String is returned unchanged.
src - any String.srch - the String to search for.repl - the replacement String.ignoreCase - a boolean determining case sensitivity of matches.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||