Skip to content

TextModifier

interface TextModifier
Package: dev.joid.lib.font.modifier · Module: core · Source: TextModifier.java

Changes the characters a text shows, such as its case, without changing its value.

Set one on a Text or a TextElement with modifier(...), or use one of the constants. It applies to the whole text at once and leaves the markup tags untouched.

ReturnsSignatureSummary
Stringmodify(String text) abstractReturns the text to show for text, without markup tags.
Stringmodify(String text, TextInfo info) defaultReturns the text to show for text, with the tags of the markups of info kept as they are and the text between them modified as one string.
StringmodifyAfter(UnaryOperator modifier, StringBuilder before, String text) staticReturns the modified form of text when it follows before, so that a modifier that depends on what comes first, such as a capital at the start, stays right across elements; text is appended to before.
StringcamelCase(String text, boolean upperFirst) staticReturns text with its words joined in camel case, the first word capitalized when upperFirst is true; any character other than a letter or a digit separates words.
StringcapitalizeWords(String text) staticReturns text with the first letter after each whitespace in title case.
TypeNameValueSummary
TextModifierLOWER_CASEtext -> text.toLowerCase(Locale.ROOT)Shows the text in lower case.
TextModifierUPPER_CASEtext -> text.toUpperCase(Locale.ROOT)Shows the text in upper case.
TextModifierCAMEL_CASEtext -> TextModifier.camelCase(text, false)Shows hello big world as helloBigWorld.
TextModifierUPPER_CAMEL_CASEtext -> TextModifier.camelCase(text, true)Shows hello big world as HelloBigWorld.
TextModifierSNAKE_CASEtext -> text.toLowerCase(Locale.ROOT).replace(" ", "_")Shows Hello big world as hello_big_world.
TextModifierCAPITALIZEStringUtils::capitalizeCapitalizes the first letter of the text.
TextModifierWORD_CAPITALIZETextModifier::capitalizeWordsCapitalizes the first letter of every word.

String modify(String text) abstract

Returns the text to show for text, without markup tags.

String modify(String text, TextInfo info) default

Returns the text to show for text, with the tags of the markups of info kept as they are and the text between them modified as one string.

String modifyAfter(UnaryOperator<String> modifier, StringBuilder before, String text) static

Returns the modified form of text when it follows before, so that a modifier that depends on what comes first, such as a capital at the start, stays right across elements; text is appended to before.

String camelCase(String text, boolean upperFirst) static

Returns text with its words joined in camel case, the first word capitalized when upperFirst is true; any character other than a letter or a digit separates words.

String capitalizeWords(String text) static

Returns text with the first letter after each whitespace in title case.

TextModifier LOWER_CASE

Shows the text in lower case.

TextModifier UPPER_CASE

Shows the text in upper case.

TextModifier CAMEL_CASE

Shows hello big world as helloBigWorld.

TextModifier UPPER_CAMEL_CASE

Shows hello big world as HelloBigWorld.

TextModifier SNAKE_CASE

Shows Hello big world as hello_big_world.

TextModifier CAPITALIZE

Capitalizes the first letter of the text.

TextModifier WORD_CAPITALIZE

Capitalizes the first letter of every word.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page