|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jeters.util.StringProtector
public class StringProtector
tool that will "protect" parts of a String identified by regular expressions by replacing them with an ID (positive integer) and some strings specified in the constructor. This functionality is useful if certain parts of a text (comments, for example) should not be exposed to regular expressions applied to the text. The number of protections is limited to the number of possible non-negative values in a Long.
Constructor Summary | |
---|---|
StringProtector(java.lang.String startMarker,
java.lang.String endMarker)
creates a new string protector |
Method Summary | |
---|---|
java.lang.String |
protect(java.lang.String s,
java.lang.String... expressions)
replaces all occurrences of given regular expressions in the String s with "protection strings" |
java.lang.String |
unprotect(java.lang.String s)
replaces the protection marks with the original text; protected text will no longer be known to this StringProtector |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringProtector(java.lang.String startMarker, java.lang.String endMarker)
startMarker
- String that will mark the
beginning of a protected partendMarker
- String that will mark the
end of a protected partMethod Detail |
---|
public java.lang.String protect(java.lang.String s, java.lang.String... expressions)
s
- string to create a
protected version fromexpressions
- regular expr.s to protect
public java.lang.String unprotect(java.lang.String s)
s
- String to remove protection marks from
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |