The Label extension provides functions for selecting text, copying and pasting text, highlighting text, setting text spacing, formatting numbers, sorting text, validating patterns, and handling click events. It also includes a method for changing the color of specific words within text, using a background thread to maintain responsiveness.
Version 1.0

- MakeTextSelectable:
- Description: This method allows making part of the text in a Label component selectable.
- Parameters:
label: The Label component in which text selection is desired.

- CopyTextToClipboard:
- Description: This method copies text to the device's clipboard.
- Parameters:
text: The text to be copied to the clipboard.

- SetTextAutoSize:
- Description: This method sets auto resizing of text to fit in the label component.
- Parameters:
label: The label component for which auto text resizing is desired.enable: A boolean indicating whether to enable (true) or disable (false) auto text resizing.

- SetTextSpacing:
- Description: This method sets the line and letter spacing of text in the label component.
- Parameters:
label: The label component for which text spacing is desired.lineSpacing: The spacing between lines of text.letterSpacing: The spacing between characters of text.

- HighlightText:
- Description: This method highlights a specific part of the text in the label component with a given color.
- Parameters:
label: The label component in which text highlighting is desired.startIndex: The start index of the text to be highlighted.endIndex: The end index of the text to be highlighted.color: The color with which to highlight the text.

- CutText:
- Description: This method cuts the selected text in the label component and copies it to the clipboard.
- Parameters:
label: The label component from which text is to be cut.

- PasteText:
- Description: This method gets text from the clipboard and returns it as a text string.
- Parameters: None.

- SearchText:
- Description: This method searches for specific text within the label component's content and returns the index of the first occurrence.
- Parameters:
label: The label component in which text search is desired.searchText: The text to be searched within the label component.

- GenerateRandomText:
- Description: Generates random text of the specified length.
- Parameters:
length: The length of the random text to generate.

- ExtractSubstring:
- Description: Extracts a substring of text from a main string based on the specified start and end indices.
- Parameters:
text: The main string from which to extract the substring.startIndex: The start index of the substring.endIndex: The end index of the substring.

- ValidateText:
- Description: Validates whether a text string matches a specific pattern using regular expressions.
- Parameters:
text: The text string to be validated.pattern: The regular expression pattern to compare against the text.

- ExtractInformation:
- Description: Extracts specific information from a text string based on a regular expression pattern and returns a list of matches.
- Parameters:
text: The text string from which to extract information.pattern: The regular expression pattern used to search for information.

- SortText:
- Description: Sorts a list of text strings in alphabetical order.
- Parameters:
textList: The list of text strings to be sorted.

- FormatNumber:
- Description: Formats a number into a text string with specific locale and style formatting.
- Parameters:
number: The number to be formatted.locale: The locale setting for number formatting.style: The desired formatting style for the number (e.g., "currency" for currency format, "percent" for percentage format, etc.).
Events:

- AfterTextSelected:
- Description: This event is triggered after a fragment of text has been selected and copied in the label component.
- Parameters:
selectedText: The selected and copied text.startIndex: The start index of the selected text.endIndex: The end index of the selected text.
Update: Version 1.1

ChangeWordsColor
- What it does: Changes the color of specific words within the text of a
LabelorTextBox. - Parameters:
component: The text component (such as aLabelorTextBox).words: List of words to color.colors: List of colors for the words.

ClickLabel
- What it does: Makes a
Labelclickable like a button. - Parameters:
label: TheLabelto be made clickable.labelId: Unique identifier of theLabel.

LabelClicked Event
- What it does: Triggered when a clickable
Labelis clicked. - Parameters:
labelText: Text of the clickedLabel.labelId: Identifier of the clickedLabel.
Screenshots Version 1.1

Blocks:
Examples for
ValidateTextandExtractInformationfunctions with regular expression patterns
Examples of ValidateText
Validating an email address
boolean isValidEmail = ValidateText("example@example.com", "^[\\w._%+-]+@[\\w.-]+\\.[a-zA-Z]{2,6}$");
// isValidEmail will be true if the email address is valid.
Validating a phone number (format: (123) 456-7890)
boolean isValidPhone = ValidateText("(123) 456-7890", "^\\(\\d{3}\\) \\d{3}-\\d{4}$");
// isValidPhone will be true if the phone number matches the format.
Validating a URL
boolean isValidURL = ValidateText("https://www.example.com", "^(https?|ftp)://[^\\s/$.?#].[^\\s]*$");
// isValidURL will be true if the URL is valid.
Validating a date in the YYYY-MM-DD format
boolean isValidDate = ValidateText("2023-06-10", "^\\d{4}-\\d{2}-\\d{2}$");
// isValidDate will be true if the date matches the format.
Examples of ExtractInformation
Extracting all email addresses from a text
String text = "Contact us at info@example.com or support@example.org";
YailList emails = ExtractInformation(text, "[\\w._%+-]+@[\\w.-]+\\.[a-zA-Z]{2,6}");
// emails will contain ["info@example.com", "support@example.org"]
Extracting all words starting with an uppercase letter
String text = "The Quick Brown Fox Jumps Over The Lazy Dog";
YailList capitalizedWords = ExtractInformation(text, "\\b[A-Z][a-z]*\\b");
// capitalizedWords will contain ["The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"]
Extracting all phone numbers (format: (123) 456-7890) from a text
String text = "Call us at (123) 456-7890 or (987) 654-3210";
YailList phoneNumbers = ExtractInformation(text, "\\(\\d{3}\\) \\d{3}-\\d{4}");
// phoneNumbers will contain ["(123) 456-7890", "(987) 654-3210"]
Extracting all URLs from a text
String text = "Visit https://www.example.com or http://www.test.com for more information";
YailList urls = ExtractInformation(text, "(https?|ftp)://[^\\s/$.?#].[^\\s]*");
// urls will contain ["https://www.example.com", "http://www.test.com"]
Extension: Versión 1.1
JoeDevLabel.aix (18.5 KB)
Thanks.

