org.omnaest.utils.strings
Class StringReplacementBuilder
java.lang.Object
org.omnaest.utils.strings.StringReplacementBuilder
public class StringReplacementBuilder
- extends Object
The StringReplacementBuilder allows to add(String, String) pairs of regEx patterns and their replacement
Strings and to process(String) values using these pairs.
- Author:
- Omnaest
- See Also:
add(String, String),
process(String)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
regExPatternToReplacementMap
protected final Map<Pattern,String> regExPatternToReplacementMap
StringReplacementBuilder
public StringReplacementBuilder()
add
public StringReplacementBuilder add(String regEx,
String replacement)
- Adds a regEx pattern
String and the corresponding replacement to the StringReplacementBuilder
- Parameters:
regEx - replacement -
- Returns:
- this
addAll
public StringReplacementBuilder addAll(Map<String,String> regExPatternStringToReplacementMap)
- Similar to
add(String, String) for a given Map
- Parameters:
regExPatternStringToReplacementMap -
- Returns:
- this
process
public String process(String value)
- Replaces all matching regEx patterns added to the
StringReplacementBuilder within the given value with the
corresponding replacement Strings
- Parameters:
value -
- Returns:
- processed
String
Copyright © 2013. All Rights Reserved.