|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.common.core.util.StringUtil
public class StringUtil
In JDK 1.3 we don't have the luxury of replaceAll as in JDK 1.4. The replace methods from this string class are intended to be used until JDK 1.4 is used. For completely different implementations of the replace methods, please see http://forum.java.sun.com/thread.jsp?forum=31&thread=284142&message=1109785 Replacing a whole word is completely different from replacing all instances. To avoid confusion, the method names are different too.
Method Summary | |
---|---|
static boolean |
doesWordExist(java.lang.String string,
java.lang.String source,
boolean caseSensitive)
Returns if a substring was found as a whole word in a string. |
static java.lang.String |
encodeURL(java.lang.String url)
Encode the url string |
static boolean |
isValidPositiveInteger(java.lang.String string)
Do not use Integer.parseInt(). |
static java.lang.String |
replace(java.lang.String string,
java.lang.String source,
java.lang.String dest,
boolean caseSensitive)
Replace the first instance of part of a string with another string. |
static java.lang.String |
replaceAll(java.lang.String string,
java.lang.String source,
java.lang.String dest,
boolean caseSensitive)
Replace all instances of part of a string with another string |
static java.lang.String |
replaceAllWholeWords(java.lang.String string,
java.lang.String source,
java.lang.String dest,
boolean caseSensitive)
Replaces whole words found in one string with another string. |
static java.lang.String |
replaceWholeWords(java.lang.String string,
java.lang.String source,
java.lang.String dest,
boolean caseSensitive)
Replaces whole words found in one string with another string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String replace(java.lang.String string, java.lang.String source, java.lang.String dest, boolean caseSensitive)
string
- is the string that contains the substring to be replacedsource
- is the substring that will be replaced if it is found
in the stringdest
- what the substring will be replaced with if it is found
in the stringcaseSensitive
- true to do a case sensitive search, false to do
a case insensitive search
public static java.lang.String replaceAll(java.lang.String string, java.lang.String source, java.lang.String dest, boolean caseSensitive)
string
- is the string that contains the substring to be replacedsource
- is the substring that will be replaced if it is found
in the stringdest
- what the substring will be replaced with if it is found
in the stringcaseSensitive
- true to do a case sensitive search, false to do
a case insensitive search
public static java.lang.String replaceWholeWords(java.lang.String string, java.lang.String source, java.lang.String dest, boolean caseSensitive)
string
- is the string that contains the substring to be replacedsource
- is the substring that will be replaced if it is found
in the stringdest
- what the substring will be replaced with if it is found
in the stringcaseSensitive
- true to do a case sensitive search, false to do
a case insensitive search
public static java.lang.String replaceAllWholeWords(java.lang.String string, java.lang.String source, java.lang.String dest, boolean caseSensitive)
string
- is the string that contains the substring to be replacedsource
- is the substring that will be replaced if it is found
in the stringdest
- what the substring will be replaced with if it is found
in the stringcaseSensitive
- true to do a case sensitive search, false to do
a case insensitive search
public static boolean doesWordExist(java.lang.String string, java.lang.String source, boolean caseSensitive)
string
- is the string that contains the substring to be replacedsource
- is the substring that we are checking for in stringcaseSensitive
- true to do a case sensitive search, false to do
a case insensitive search
public static boolean isValidPositiveInteger(java.lang.String string)
string
- to check if it is a valid positive integer
public static java.lang.String encodeURL(java.lang.String url)
url
- String to encode
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.