Action: Text Manipulation

Revision as of 23:02, 6 February 2024 by JosueGd (talk | contribs)
This action can be used to perform basic string manipulation on a text string.
The replace text and extract text functions support the use of regex.

Substring

Returns a sub-section of the text defined by the supplied start and end indexes. The first character starts at index 0 and the last index is excluded. (To get the first character use values 0 and 1.)

For example, in this string, 'hello I am using
the Macrodroid application', we can obtain the word 'Macrodroid' by using the initial position 17 and the last position 27.

Replace all

The given function utilises a regular expression to substitute matching text with the provided new text.

For instance, if
the source text is "Hello, how are you?"
let's change the text "Hello" (text to replace)
by new text "Hi" then the final output will be 'Hi, how are you?'

Extract text

A regular expression can be used to match and extract specific sections of text.

For example, if the
text contains a phone number
such as 'My phone
number is 1234567890', the expression '[0-9]' can be used to extract only the digits and obtain the phone number.

Upper case

Converts the text to all uppercase letters.

Example of use
Source text "Macrodroid is my application to automate my device".
Output text
"MACRODROID IS MY APP TO AUTOMATE MY DEVICE".

Lower case

Converts the text to all lower case characters.

Example Usage
Source text
"MACRODROID IS MY APP TO AUTOMATE MY DEVICE".
Output text
"macrodroid is my app to automate my device".

Trim whitespace

Removes any leading/trailing whitespace from the text.

Example Usage

Source text
"macrodroid is my app to automate my device".
Output text
"macrodroidismyapptoautomatemydevice".

Remove text

Remove text from some variable using plain text or Regex

Example Usage

Source text
the text to remove is "MACRODROID".
"MACRODROID IS MY APP TO AUTOMATE MY DEVICE".
Output text
" is my app to automate my device".