String manipulation operator

In this section, you will find the information about String manipulation operator.

What are they?

See them below:

OperatorExampleAction
concatconcat(constant(“cachorro”), constant(“quente”))The operator concatenates the strings it has as inputs.
capitalizecapitalize(constant(“brasil”))The operator transforms the first string letter into upper case.
uppercaseuppercase(constant(“brasil”))The operator transforms every letter of a string into upper case.
lowercaselowercase(constant((“BRASIL”))The operator transforms every letter of a string into lower case.
substrsubstr(constant(“brasil”), constant(3))The operator returns a substring of an input string. This operation may have 2 or 3 inputs, where the first parameter is the string and the second and third ones are the string’s threshold.

Example

The example shows a screen that has a text with a substring operation. It has the sentence

  • ‘The book is on the table’ a

The parameters are:

  • 4, 11 This shows the substring’s limit changing the string to: book is on':

See below:

fun screen() = Screen(
  child = Container(
            children = listOf(
                Text(text = constant("The text bellow is a substring of `The book is on the table`.")),
                Container(
                    children = listOf(
                        Text(substring(constant("The book is on the table"), constant(4), constant(11)))
                    )
                ).setStyle { backgroundColor = constant("#00FF00") }
            )
        )
    )