Text Length

From UBot Studio
Jump to: navigation, search

$Text Length is a Text Function.

The function returns the total length of string.

Please see Pad Text for more examples.

Text: The text where the text length will be pulled from. Accepts variables and functions such as $next list item, $list item, $random list item, $previous list item, and $table cell under Text to Type.

Example 1

set(#text length, $text length("mytext"), "Global")


Txtlngth.jpg

Running the script sets the variable to the total text length of the string.


Example 2

Use the text length function to limit the amount of characters required for a field.

For example:

ui text box("mytext", #mytext)
if($comparison($text length(#mytext), ">", 10)) {
    then {
        alert("Please enter 10 characters or less")
    }
    else {
        navigate("google.com", "Wait")
    }
} 

The following example will generate am alert to the end user if the length of the provided text in the UI is longer than required.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox