Package hudson
Class MarkupText.SubText
java.lang.Object
hudson.AbstractMarkupText
hudson.MarkupText.SubText
- Enclosing class:
MarkupText
Represents a substring of a
MarkupText.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a start tag and end tag at the specified position.protected MarkupText.SubTextintend()Gets the end index of this subtext withinMarkupText.getText().intend(int groupIndex) Gets the end index of the captured group withinMarkupText.getText().getText()Returns the plain text portion of thisMarkupTextwithout any markup, nor any escape.group(int groupIndex) Gets the text that represents the captured group.intHow many captured groups are in this subtext.voidSurrounds this subtext with<a>…</a>.Replaces the group tokens like "$0", "$1", and etc with their actual matches.intstart()Gets the start index of this subtext withinMarkupText.getText().intstart(int groupIndex) Gets the start index of the captured group withinMarkupText.getText().subText(int start, int end) Returns a subtext.voidsurroundWith(String startTag, String endTag) Surrounds this subtext with the specified start tag and the end tag.voidsurroundWithLiteral(String startTag, String endTag) Works likesurroundWith(String, String)except that the token replacement is not performed on parameters.Methods inherited from class hudson.AbstractMarkupText
addHyperlink, addHyperlinkLowKey, charAt, findToken, findTokens, hide, length, wrapBy
-
Constructor Details
-
SubText
-
SubText
public SubText(int start, int end)
-
-
Method Details
-
subText
Description copied from class:AbstractMarkupTextReturns a subtext.- Specified by:
subTextin classAbstractMarkupText- Parameters:
end- If negative, -N means "trim the last N-1 chars". That is, (s,-1) is the same as (s,length)
-
getText
Description copied from class:AbstractMarkupTextReturns the plain text portion of thisMarkupTextwithout any markup, nor any escape.- Specified by:
getTextin classAbstractMarkupText
-
addMarkup
Description copied from class:AbstractMarkupTextAdds a start tag and end tag at the specified position.For example, if the text was "abc", then
addMarkup(1,2,"<b>","</b>")would generate"a<b>b</b>c"- Specified by:
addMarkupin classAbstractMarkupText
-
surroundWith
Surrounds this subtext with the specified start tag and the end tag.Start/end tag text can contain special tokens "$0", "$1", ... and they will be replaced by their
group match. "\$" can be used to escape characters. -
surroundWithLiteral
Works likesurroundWith(String, String)except that the token replacement is not performed on parameters. -
href
Surrounds this subtext with<a>…</a>. -
start
public int start(int groupIndex) Gets the start index of the captured group withinMarkupText.getText().- Parameters:
groupIndex- 0 means the start of the whole subtext. 1, 2, ... are groups captured by '(...)' in the regexp.
-
start
public int start()Gets the start index of this subtext withinMarkupText.getText(). -
end
public int end(int groupIndex) Gets the end index of the captured group withinMarkupText.getText(). -
end
public int end()Gets the end index of this subtext withinMarkupText.getText(). -
group
Gets the text that represents the captured group. -
groupCount
public int groupCount()How many captured groups are in this subtext.- Since:
- 1.357
-
replace
Replaces the group tokens like "$0", "$1", and etc with their actual matches. -
createSubText
- Specified by:
createSubTextin classAbstractMarkupText
-