Transform string to prefixes
Function: Transform string to prefixes
This function takes a single piece of text (a string) and breaks it down into a list of all its possible starting segments, also known as prefixes. For example, if you provide the word "Hello", it will generate a list containing "H", "He", "Hel", "Hell", and "Hello". This can be useful for tasks like auto-completion, search suggestions, or data analysis where you need to work with parts of a word or phrase.
Input
- String: The piece of text you want to transform into a list of prefixes. This input is required.
Output
- Result: This is the output slot where the action provides the generated list of prefixes. You will specify a variable name in your action configuration (e.g.,
myPrefixList), and the action will store the list of prefixes (which will be anARRAYofSTRINGvalues) into that variable within your application's "Variable scope."
Execution Flow
Real-Life Examples
Example 1: Generating search suggestions for products Imagine you're building a search bar for products in your e-commerce application. As a user types, you want to show suggestions based on what they've entered so far.
- Inputs:
- String:
Smartwatch - Result (Variable Name):
searchPrefixes
- String:
- Result:
The application will store the list
["S", "Sm", "Sma", "Smar", "Smart", "Smartw", "Smartwa", "Smartwat", "Smartwatc", "Smartwatch"]into a variable namedsearchPrefixes. You can then use this list to query your product database for matching items.
Example 2: Analyzing customer feedback keywords You have a system that collects customer feedback, and you want to analyze common starting phrases or keywords to identify trends or issues.
- Inputs:
- String:
Problem with delivery - Result (Variable Name):
feedbackKeywords
- String:
- Result:
The application will store the list
["P", "Pr", "Pro", "Prob", "Probl", "Proble", "Problem", "Problem ", "Problem w", "Problem wi", "Problem wit", "Problem with", "Problem with ", "Problem with d", "Problem with de", "Problem with del", "Problem with deli", "Problem with deliv", "Problem with delive", "Problem with deliver", "Problem with delivery"]into a variable namedfeedbackKeywords. This list can help you categorize and analyze feedback more effectively.
Example 3: Creating dynamic filters for inventory codes You're building a dashboard where users can filter inventory items by the beginning of their unique inventory codes.
- Inputs:
- String:
INV-XYZ-007 - Result (Variable Name):
inventoryCodePrefixes
- String:
- Result:
The application will store the list
["I", "IN", "INV", "INV-", "INV-X", "INV-XY", "INV-XYZ", "INV-XYZ-", "INV-XYZ-0", "INV-XYZ-00", "INV-XYZ-007"]into a variable namedinventoryCodePrefixes. This list can be used to populate a dropdown or a set of buttons for quick filtering.