public class

DelimeterInserter

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.DelimeterInserter

Class Overview

This can take an input string and look into it for occurences of given terms. It will then intert delimeters into the input string arround the terms. You can use this to hilight text with bold tags in HTML for example.

This is smart enough to merge areas when they overlap or exit side by side, and only one set of delimeters will be inserted.

Summary

Public Constructors
DelimeterInserter(String frontDelimeter, String endDelimeter)
Creates a DelimeterInserter that is in prefix mode and case insenstive.
DelimeterInserter(String frontDelimeter, String endDelimeter, boolean prefixMode)
Creates a DelimeterInserter that is case insenstive.
DelimeterInserter(String frontDelimeter, String endDelimeter, boolean prefixMode, boolean caseInsensitive)
Public Methods
String getConsideredWhitespace()
String insert(String targetString, String[] terms)
Called to do the actual delimeter intertion
void setConsideredWhitespace(String consideredWhitespace)
The String characters that can be considered whitespace ALONG with Character.iswhiteSpace().
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DelimeterInserter (String frontDelimeter, String endDelimeter)

Creates a DelimeterInserter that is in prefix mode and case insenstive.

Parameters
frontDelimeter the delimeter to use as around the front of a term
endDelimeter the delimeter to use as around the end of a term

public DelimeterInserter (String frontDelimeter, String endDelimeter, boolean prefixMode)

Creates a DelimeterInserter that is case insenstive.

Parameters
frontDelimeter the delimeter to use as around the front of a term
endDelimeter the delimeter to use as around the end of a term
prefixMode whether a match must be made on word boundaries

public DelimeterInserter (String frontDelimeter, String endDelimeter, boolean prefixMode, boolean caseInsensitive)

Parameters
frontDelimeter the delimeter to use as around the front of a term
endDelimeter the delimeter to use as around the end of a term
prefixMode whether a match must be made on word boundaries
caseInsensitive whether matching is case insenstive

Public Methods

public String getConsideredWhitespace ()

Returns
  • the String characters that can be considered whitespace ALONG with Character.iswhiteSpace().

public String insert (String targetString, String[] terms)

Called to do the actual delimeter intertion

Parameters
targetString the target string to insert the delimeters into
terms the terms to look for in the targetString
Returns
  • a string with delimeters around any terms within it

public void setConsideredWhitespace (String consideredWhitespace)

The String characters that can be considered whitespace ALONG with Character.iswhiteSpace().

Parameters
consideredWhitespace the extra whitespace characters