public class Replacer extends Object
The only potential difference between using the methods of Replacer to do the replacing is that Replacer remembers changes to the replacing object between calls to replaceAll, replaceFirst etc. For details, see the example file trans3.java.
Transformer
,
Regex
Constructor and Description |
---|
Replacer()
Instantiate a new Replacer.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(Regex r)
Another form of apply, it is the same as
apply(r,r.getReplaceRule()).
|
void |
apply(RegRes r,
ReplaceRule rp)
This method allows you to apply the results of several
matches in a sequence to modify a String of text.
|
void |
apply1(RegRes rr) |
Object |
clone()
Create a field for field copy of this Object if this Object
implements the Cloneable interface.
|
StringLike |
finish()
This finishes the replacement, appending the right() part of
the last RegRes given to substitute(RegRes).
|
Regex |
getRegex() |
boolean |
isSpecial(ReplaceRule x) |
int |
lastMatchedTo() |
String |
replaceAll(String s) |
StringLike |
replaceAll(StringLike s) |
String |
replaceAllFrom(String s,
int start) |
StringLike |
replaceAllFrom(StringLike s,
int start) |
String |
replaceAllRegion(String s,
int start,
int end) |
StringLike |
replaceAllRegion(StringLike s,
int start,
int end) |
StringLike |
replaceAllRegion(StringLike s,
Regex r,
int start,
int end)
This method replaces all occurences of the Regex in the
String starting with postition pos
according to the Replacer rule of this object.
|
StringLike |
replaceAllRegion(String s,
Regex r,
int start,
int end) |
StringLike |
replaceFirst(StringLike s) |
StringLike |
replaceFirstFrom(StringLike s,
int start) |
StringLike |
replaceFirstRegion(StringLike s,
int start,
int end) |
StringLike |
replaceFirstRegion(StringLike s,
Regex r,
int start,
int end)
This method replaces the first occurence of the Regex in the
String starting with position pos
according to the Replacer rule of this object.
|
StringLike |
replaceFirstRegion(String s,
Regex r,
int start,
int end) |
void |
setBuffer(StringBufferLike sbl) |
void |
setPos(int pos) |
void |
setSource(StringLike sl) |
boolean |
WantMoreText() |
public StringLike replaceFirstRegion(String s, Regex r, int start, int end)
public StringLike replaceFirstRegion(StringLike s, Regex r, int start, int end)
public StringLike replaceFirst(StringLike s)
public StringLike replaceFirstFrom(StringLike s, int start)
public StringLike replaceFirstRegion(StringLike s, int start, int end)
public StringLike replaceAllRegion(String s, Regex r, int start, int end)
public StringLike replaceAllRegion(StringLike s, Regex r, int start, int end)
public StringLike replaceAll(StringLike s)
public StringLike replaceAllFrom(StringLike s, int start)
public StringLike replaceAllRegion(StringLike s, int start, int end)
public final boolean isSpecial(ReplaceRule x)
public final void apply1(RegRes rr)
public void apply(RegRes r, ReplaceRule rp)
public boolean WantMoreText()
public void apply(Regex r)
public StringLike finish()
public Object clone()
Object
public int lastMatchedTo()
public Regex getRegex()
public void setSource(StringLike sl)
public void setBuffer(StringBufferLike sbl)
public void setPos(int pos)