| Line 1: |
Line 1: |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | This action can be used to perform basic string manipulation on a text string. | | 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. |
| | + | </pre> |
| | + | |
| | + | '''Substring''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | 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. |
| | + | </pre> |
| | + | |
| | + | '''Replace all''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | 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?' |
| | + | </pre> |
| | + | |
| | + | '''Extract text''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | 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. |
| | + | </pre> |
| | + | |
| | + | '''Upper case''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | 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". |
| | + | </pre> |
| | + | |
| | + | '''Lower case''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | 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". |
| | + | </pre> |
| | + | |
| | + | '''Trim whitespace''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | Removes any leading/trailing whitespace from the text. |
| | + | |
| | + | Example Usage |
| | + | |
| | + | Source text |
| | + | "macrodroid is my app to automate my device". |
| | + | Output text |
| | + | "macrodroidismyapptoautomatemydevice". |
| | + | </pre> |
| | + | |
| | + | '''Remove text''' |
| | + | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> |
| | + | Remove text from some variable using plain text or Regex |
| | + | |
| | + | Example Usage |
| | + | |
| | + | Source text "MACRODROID IS MY APP TO AUTOMATE MY DEVICE". |
| | + | the text to remove is "MACRODROID". |
| | + | Output text |
| | + | " is my app to automate my device". |
| | + | </pre> |