public class SearchAndReplaceTextInContent
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
REPLACE_ALL
Replace at all positions.
|
| Constructor and Description |
|---|
SearchAndReplaceTextInContent(java.lang.String content,
java.lang.String searchText,
java.lang.String replaceText,
int matchPosition)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getNumReplaces()
Get the number of replaces.
|
java.lang.String |
getResultContent()
Get the result content.
|
public static final int REPLACE_ALL
public SearchAndReplaceTextInContent(java.lang.String content,
java.lang.String searchText,
java.lang.String replaceText,
int matchPosition)
content - the content in which the text is searched and replacedsearchText - the search text. Note that the search text must have a minimum length of one.replaceText - the replace textmatchPosition - the search match position where the text is replaced (1..n), or set REPLACE_ALL to replace the search text at all positions. Note that a value of 0 (zero) is not valid.java.lang.IllegalArgumentException - if the search text is an empty string or if the match position is 0 (zero) or less than REPLACE_ALLREPLACE_ALL