|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.shlublu.javax.lang.StringSubstitutor
String convenience tool for substitutions.
Constructor Summary | |
StringSubstitutor()
Empty constructor |
|
StringSubstitutor(java.lang.String strDataGiven)
Convenience constructor |
Method Summary | |
int |
count(java.lang.String strToken)
Return the number of occurences of the token in the contained string |
int |
count(java.lang.String strToken,
int iStartIndex)
Return the number of occurences of the token in the contained string, starting the search from iStartIndex. |
int |
delete(java.lang.String strToken)
Parse the contained string to remove the strToken occurences. |
int |
delete(java.lang.String strToken,
int iStart)
Parse the contained string starting from the given index, removing the strToken occurences. |
java.util.Vector |
getOccurences(java.lang.String strToken)
Return the occurences of strToken in the contained string. |
java.util.Vector |
getOccurences(java.lang.String strToken,
int iStart)
Return the occurences of strToken located after iStart in the contained string. |
int |
replace(java.lang.String strToken,
java.lang.String strBy)
Parse the contained string to replace strToken by strBy. |
int |
replace(java.lang.String strToken,
java.lang.String strBy,
int iStart)
Parse the contained string starting from the given index, replacing strToken by strBy. |
void |
setData(java.lang.String strData)
Set the string to parse. |
java.lang.String |
toString()
Return the parsed string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StringSubstitutor(java.lang.String strDataGiven)
String
- strData The string to parsepublic StringSubstitutor()
Method Detail |
public final void setData(java.lang.String strData)
strData
- The string to parse. Shouldn't be null if you plan to call replacepublic final java.lang.String toString()
toString
in class java.lang.Object
public final int replace(java.lang.String strToken, java.lang.String strBy)
replace(strToken, strBy, 0)
- Parameters:
strToken
- The token to replace. Musn't be null.strBy
- The replace by sequence. Musn't be null.- Returns:
- The number of done replacements
- See Also:
replace(java.lang.String,java.lang.String,int)
replace
public final int replace(java.lang.String strToken,
java.lang.String strBy,
int iStart)
- Parse the contained string starting from the given index, replacing
strToken by strBy.
- Parameters:
strToken
- The token to replace. Musn't be null.strBy
- The replace by sequence. Musn't be null.iStart
- The starting index (included)- Returns:
- The number of done replacements
- Throws:
NullPointerException
- when one of the argument or the source string is nulljava.lang.IllegalArgumentException
- when iStart is < 0
delete
public final int delete(java.lang.String strToken)
- Parse the contained string to remove the strToken occurences.
- Parameters:
strToken
- The token to replace. Musn't be null.- Returns:
- The number of done deletions
- Throws:
NullPointerException
- when one of the argument or the source string is nulljava.lang.IllegalArgumentException
- when iStart is < 0- Since:
- 0.7
delete
public final int delete(java.lang.String strToken,
int iStart)
- Parse the contained string starting from the given index, removing the
strToken occurences.
- Parameters:
strToken
- The token to replace. Musn't be null.iStart
- The starting index (included)- Returns:
- The number of done deletions
- Throws:
NullPointerException
- when one of the argument or the source string is nulljava.lang.IllegalArgumentException
- when iStart is < 0- Since:
- 0.7
count
public final int count(java.lang.String strToken)
- Return the number of occurences of the token in the contained string
- Parameters:
strToken
- The token- Returns:
- The number of occurences of strToken
- Since:
- 0.7
count
public final int count(java.lang.String strToken,
int iStartIndex)
- Return the number of occurences of the token in the contained string, starting
the search from iStartIndex.
- Parameters:
strToken
- The tokeniStartIndex
- The beginning index- Returns:
- The number of occurences of strToken
- Since:
- 0.7
getOccurences
public final java.util.Vector getOccurences(java.lang.String strToken)
- Return the occurences of strToken in the contained string.
If no occurence is found, null is returned.
The occurences are stored as Integer wrappers. Too bad for the perfs but
that's the only way.
- Parameters:
strToken
- The token string- Returns:
- The occurences Vector, or null if none
- Since:
- 0.7
getOccurences
public final java.util.Vector getOccurences(java.lang.String strToken,
int iStart)
- Return the occurences of strToken located after iStart in the contained string.
If no occurence is found, null is returned.
The occurences are stored as Integer wrappers. Too bad for the perfs but
that's the only way.
- Parameters:
strToken
- The token stringiStart
- The starting index in the contained string- Returns:
- The occurences Vector, or null if none
- Since:
- 0.7
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD