Class WordReplacer
- java.lang.Object
-
- com.cloudbees.jenkins.support.util.WordReplacer
-
public class WordReplacer extends Object
-
-
Constructor Summary
Constructors Constructor Description WordReplacer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
replaceWord(StringBuilder input, String word, String replace)
Replace all occurrences of word by replace in the input.static String
replaceWord(String input, String word, String replace)
Replace all occurrences of word by replace in the input.static void
replaceWordIgnoreCase(StringBuilder input, String word, String replace)
static String
replaceWordIgnoreCase(String input, String word, String replace)
Replace all occurrences of word by replace in the input.static void
replaceWords(StringBuilder input, String[] words, String[] replaces)
static String
replaceWords(String input, String[] words, String[] replaces)
Replace all words in the input by the replaces.static void
replaceWordsIgnoreCase(StringBuilder input, String[] words, String[] replaces)
static String
replaceWordsIgnoreCase(String input, String[] words, String[] replaces)
Replace all words in the input by the replaces.
-
-
-
Method Detail
-
replaceWords
public static String replaceWords(String input, String[] words, String[] replaces)
Replace all words in the input by the replaces. The replacements happens only if the texts to replace are not part of a greater word, that is, if the text is a whole word, separated by nonCharacter.isLetterOrDigit(char)
characters.- Parameters:
input
- the text where the replacements take placewords
- the words to look for and replacereplaces
- the new words to use
-
replaceWordsIgnoreCase
public static String replaceWordsIgnoreCase(String input, String[] words, String[] replaces)
Replace all words in the input by the replaces. The replacements happens only if the texts to replace are not part of a greater word, that is, if the text is a whole word, separated by nonCharacter.isLetterOrDigit(char)
characters.- Parameters:
input
- the text where the replacements take placewords
- the words to look for and replacereplaces
- the new words to use
-
replaceWords
public static void replaceWords(StringBuilder input, String[] words, String[] replaces)
- Parameters:
input
- the text where the replacements take placewords
- the words to look for and replacereplaces
- the new words to use
-
replaceWordsIgnoreCase
public static void replaceWordsIgnoreCase(StringBuilder input, String[] words, String[] replaces)
- Parameters:
input
- the text where the replacements take placewords
- the words to look for and replacereplaces
- the new words to use
-
replaceWord
public static String replaceWord(String input, String word, String replace)
Replace all occurrences of word by replace in the input. The replacement happens only if the word to replace is separated from others words, that is, it's not part of a word. The implementation is that the previous and next characters of the word must be aCharacter.isLetterOrDigit(char)
char.- Parameters:
input
- text where the replacements take placeword
- the word to replacereplace
- the new text to use
-
replaceWordIgnoreCase
public static String replaceWordIgnoreCase(String input, String word, String replace)
Replace all occurrences of word by replace in the input. The replacement happens only if the word to replace is separated from others words, that is, it's not part of a word. The implementation is that the previous and next characters of the word must be aCharacter.isLetterOrDigit(char)
char.- Parameters:
input
- text where the replacements take placeword
- the word to replacereplace
- the new text to use
-
replaceWord
public static void replaceWord(StringBuilder input, String word, String replace)
Replace all occurrences of word by replace in the input. The replacement happens only if the word to replace is separated from others words, that is, it's not part of a word. The implementation is that the previous and next characters of the word must be aCharacter.isLetterOrDigit(char)
char.- Parameters:
input
- text where the replacements take placeword
- the word to replacereplace
- the new text to use
-
replaceWordIgnoreCase
public static void replaceWordIgnoreCase(StringBuilder input, String word, String replace)
-
-