Text functions 1
All of the following examples assume summary field value of Hello World!
.
abbreviate(int maxLength)
Abbreviates the text to the defined number of characters and adds "..." to the end. maxLength parameter needs to be at least 4
{{issue.summary.abbreviate(8)}} -> Hello Wo...
{{issue.summary.abbreviate(4)}} -> Hell...
More info on StringUtils.abbreviate(int)
chartAt(int index)
Identifies the character at the specified position in the text.
{{issue.summary.charAt(2)}} -> e
{{issue.summary.charAt(12)}} -> !
{{issue.summary.charAt(7)}} -> W
More info on String.charAt(int)
capitalize()
Capitalizes the first character.
{{issue.summary.capitalize()}} -> Hello world!
More info on StringUtils.capitalize(String)
concat(String str)
Adds a specified string to the end.
{{issue.summary.concat(" It's a beautiful day!")}} -> Hello World! It's a beautiful day!
More info on String.concat(String)
endsWith(String str)
Checks if the text ends with the specified text and returns true or false.
{{issue.summary.endsWith("World!")}} -> true
{{issue.summary.endsWith("World@")}} -> false
More info on String.endsWith(String)
htmlEncode()
Encodes text to allow it to be included in HTML content.
{{issue.summary.htmlEncode}} -> Hello world!
indexOf(String str)
Returns the position of the first character in the specified text in the text
{{issue.summary.indexOf("Wo")}} -> 6
{{issue.summary.indexOf("ello")}} -> 2
{{issue.summary.indexOf("d!")}} -> 11
More info on String.indexOf(String)
isAlpha()
Checks if the text contains only letters and returns true or false
{{issue.summary.isAlpha()}} -> true
More info on StringUtils.isAlpha()
isAlphanumeric()
Checks if the text contains only letters or numbers and returns true or false
{{issue.summary.isAlphanumeric()}} -> true
More info on StringUtils.isAlphanumeric()
isEmpty()
Checks to see if the text is empty and returns true or false
{{issue.summary.isEmpty()}} -> false
More info on StringUtils.isEmpty()
isNotEmpty()
Checks to see if the text is not empty and returns true or false
{{issue.summary.isNotEmpty()}} -> true
More info on StringUtils.isNotEmpty()
isNumeric()
Checks if the text contains only numbers and returns true or false
{{issue.summary.isNumeric()}} -> false
More info on StringUtils.isNumeric()
jsonEncode()
Encodes text to allow it to be included in JSON calls. E.g. outgoing webhook. See Encoding below
{{issue.summary.jsonEncode}} -> Hello World!
lastIndexOf(String str)
Returns the position of the last character in the specified text in the text
{{issue.summary.lastIndexOf("wo")}} -> 7
{{issue.summary.lastIndexOf("ll")}} -> 4
{{issue.summary.lastIndexOf("rl")}} -> 9
More info on string.lastIndexOf(String)
left(int length)
Returns the characters, from the specified amount of characters, from the left of the text.
{{issue.summary.left(5)}} -> Hello
{{issue.summary.left(9)}} -> Hello Wor
{{issue.summary.left(2)}} -> He
More info on StringUtils.left(int)
leftPad(int length, String pad)
Adds characters to the beginning of the text until the specified total number of characters is reached
{{issue.summary.leftPad(14, "-")}} -> --Hello World!
{{issue.summary.leftPad(20, "|")}} -> ||||||||Hello World!
More info on StringUtils.leftPad(int, String)
length()
Returns the number of characters in the text
{{issue.summary.length()}} -> 12
More info on String.length()
match()
Performs a regular expression search and returns the first (and only one) matching regular expression group. The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches. If multiple matches are found, they return as a collection that can be iterated. This can be used to find a single pattern match (e.g. extract a version number from the issue description) or to match multiple patterns (e.g. extract all e-mail addresses from an issue comment).
{{issue.summary.match(".*(lo).*")}} -> lo {{issue.summary.match(".*(o).*")}} -> [o, o]
quote()
Escapes the smart value into a literal text expression that can be used in a regular expression match using Pattern.quote().
{{issue.summary.quote()}} -> \QHello(.*)World!\E<
remove(String remove)
Removes characters from text
{{issue.summary.remove("l")}} -> Heo Word!
More info on StringUtils.remove(String)
replace(String target, String replacement)
Replaces all literal text matches with a specified replacement.
{{issue.summary.replace("Hello","Goodbye")}} -> Goodbye World!
More info on String.replace(String, String)
replaceAll(String regex, String replacement)
Performs a regular expression search and replaces any match with the replacement. $1 can be used to access a matching group in the replacement.
{{issue.summary.replaceAll("(lo)","xx$1yy")}} -> Helxxloyy World!
More info on String.replaceAll(String, String)
reverse()
Reverses the characters in the text
{{issue.summary.reverse()}} -> !dlroW elloH
More info on StringUtils.reverse()
right(int length)
Returns the characters, from the specified amount of characters, from the right of the text.
{{issue.summary.right(6)}} -> World!
More info on StringUtils.right(int)
rightPad(int length, String pad)
Adds characters to the end of the text until the specified total number of characters is reached.
{{issue.summary.<br/>rightPadPad(14,"-")}} -> Hello World!--
More info on StringUtils.rightPad(int, String) for full details.
split(String separator)
Splits the text and returns the word specified by the word's position in the text
{{issue.summary.split(" ").first}} -> Hello
More info on String.split(String)
startsWith(String str)
Checks if the text starts with the specified text and returns true or false.
{{issue.summary.startsWith("World!")}} -> false
More info on String.startsWith(String)
substring(int start)
Returns the characters after the amount of characters specified
{{issue.summary.substring(7)}} -> orld!
More info on StringUtils.substring(int)
substring(int start, int end)
Returns the characters at the positions specified
{{issue.summary.substring(1,3)}} -> el
More info on StringUtils.substring(int, int)
substringAfter( String separator)
Returns the text after the first time the separator
{{issue.summary.substringAfter("W")}} -> orld!
More info on StringUtils.substringAfter(String)
substringAfterLast(String separator)
Returns the text after the last occurrence of the given separator.
{{issue.summary.substringAfterLast("o")}} -> rld!
More info on StringUtils. substringAfterLast(String)
substringBefore(String separator)
Returns the text before the first occurrence of the given separator.
{{issue.summary.substringBefore("W")}} -> Hello
More info on StringUtils. substringBefore(String)
substringBeforeLast(String separator)
Returns the text before the last occurrence of the given separator.
{{issue.summary.substringBeforeLast("o")}} -> Hello W
More info on StringUtils. substringBeforeLast(String)
substringBetween(String open, String close)
Returns the text between the given parameters.
{{issue.summary.substringBetween("e","d")}} -> llo Worl
More info on StringUtils. substringBetween(String, String)
toLowerCase()
Turns all of the text to lower case
{{issue.summary.toLowerCase()}} -> hello world!
More info on String.toLowerCase()
toUpperCase()
Turns all of the text to upper case
{{issue.summary.toUpperCase(}}}} -> HELLO WORLD!
More info on String.toUpperCase()
trim()
Removes any whitespace at the beginning or end of the value.
{{issue.summary.trim()}} -> Hello World!
More info on String.trim()
urlEncode()
Encodes text to allow them to be included as a URL param. E.g. link in an email
{{issue.summary.urlEncode}} -> See Encoding below.
xmlEncode()
Encodes text to allow them to be included in XML data. E.g. outgoing webhook
{{issue.summary.xmlEncode}} -> See Encoding below.
Encoding
When integrating with other systems or sending emails, you may need to encode the text to comply with standards or not break things. For example, if you are sending an HTML email, you may need to encode an issue's description as HTML. This escapes specific characters to comply with the HTML Specs.
Html encoding
HTML encoding is useful for emails and exporting HTML pages. For example Waiting for R&D
would be encoded as Waiting for R&D
.
// Function
{{#htmlEncode}}{{issue.status.name}}{{/}}
// Inline version
{{issue.status.name.htmlEncode}}
Json encoding
Useful when sending outgoing webhooks as JSON. For example "Hello World"
would be encoded as \"Hello World\"
.
// Function
{{#jsonEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.jsonEncode}}
URL encoding
Useful when sending creating links in emails. For example Hello & World
would be encoded as Hello%20%26%20World
.
// Function
{{#urlEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.urlEncode}}
Xml encoding
Useful when sending Outgoing webhooks as XML. For example Hello & World
would be encoded as Hello & World
.
// Function
{{#xmlEncode}}{{issue.description}}{{/}}
// Inline function
{{issue.description.xmlEncode}}