Text (String)
The Text (String) service allows you to create Flow XO actions (not triggers) that modify the input you give to generate a new output.
In general terms, when dealing with web based apps, a piece of text is referred to as a ' string'. This just refer's to the entire text you give, including all the spaces and punctuation.
We use the term 'text' in Flow XO methods and action, but in other apps you might see the name 'string'. They're essentially the same thing. You only need to remember that everything that you give to Flow XO is recognized as a character in your text - all the punctuation, spaces and anything else.
As a simple example, "Hello World!" is made of 10 letters, but the entirety of the text here - the string - is 10 letters, 2 sets of double inverted commas (" and "), 1 exclamation mark (!) and one white space ( ). The length of the entire text (the string) is 10+2+1+1 = 14 characters. As an aside, Flow XO always starts counting at number 1 - makes sense, really!
You can use the following actions, each of which is described below:
- Apply Case - Change the text you give to all uppercase or lowercase characters, to 'sentence' case (capitals after a full stop '.') or to title case (first character of each individual word 'uppercased'.)
- Find Matches - Returns 'matches' found in your text as individual outputs. This method uses a 'Regular Expression' input, on which there's some further information below for advanced users.
- Get Length - Returns a single numerical output that describes the total number of characters in the text you provide (including punctuation and spaces.)
- Join Text - Returns a single output which is an ordered combination of all the inputs you give, with an optional 'separator'.
- Replace Text - Find characters or words in text that you give and replace them with something else. Advanced users can optionally use a 'Regular Expression' as a search / find term.
- Slice Text - Return as an output only part of the text that you give as an input.
- Split Text - Opposite of 'Join Strings'. This action takes just one text input and breaks it into separate outputs based on a given separator.
- Truncate Text - Return shortened text which is a part of the longer text you provided. (Also known as a 'substring')
In all these actions, you will be given a input named 'Text', into which you can either type you own text, or more likely, give an output that you've generated earlier in your flow.
In these examples we'll use the more expansive text hello world. how are you?
For reference, that text (string) is 25 characters long, including all spaces and punctuation.
A final note - As per the notes above, some of these actions make use of regular expressions or regex. Advanced users might find this site useful for testing them out.
Apply Case
This action is really straight forward - it just changes the capitalization of some or all of the letters in your text.
You can chose from lower, upper, sentence or title case. let's consider the impact on the text hello world. how are you? of each of these in turn:
Lowercase - hello world. how are you? (No change - we were already all lowercase!)
Uppercase - HELLO WORLD. HOW ARE YOU?
Sentence - Hello world. How are you?
Title - Hello World. How Are You?
Find Matches
This is an action for advanced users.
In this action you'll give some text and then provide a regular expression that 'slices' out individual matches and provides them as an individual output.
As an example, let's consider our example text hello world. how are you?
I'll give an input to the regex field of /([o])/g
Doing so will return a four outputs in this case - all of them will be the single character 'o' which has been matched from hello world. how are you?
Get Length
This is a really simple action, but relies on the important concept discussed above about what forms the total character count of the text (string).
Flow XO will return a single numerical output that is a count of all the characters in the text (string).
In our example: hello world. how are you? will return an output of 25
Join Text
You might have come across the terms 'concatenate' - which is exactly what this action does!
You'll be asked to give an input to the field 'Separator', which allows you to give a value that will be inserted between all the other inputs that you give. You can then give up to 20 separate pieces of text.
So I might give the Separator as , (a single comma) - and then in the following two inputs, give our familiar text hello world. how are you?
This would return a single output which would contain hello world. how are you?,hello world. how are you?
Replace Text
Replace Text allows you to do just that - find either a single characters or multiple characters in a row (a string!) and replace them with anything else.
You'll be asked, as always, to give the text you want to work with as the first input. As always, we'll give hello world. how are you? in this example.
The next options are presented as a 'dictionary' field. These are really simple - they just allow you to match two value together. the first, on the left is called the 'Key' which is some text that appears in your original text string you gave into the first output. The second, to the right of it, is the 'Value', which you'd like to change you given text into.
In this example well give the following:
This will return the output Hello world. How are you?
To stress the point, you could also have just used a single key here - h - and a single value - H - and you would get the same result!
The other input here - 'Fallback Text' - allows you to replace text with something else if no matching 'Key' is found in the text you provide. For instance, you might choose to return 'No Matches' in the event that your 'Key' wasn't found in the string.
Advanced user can also give a regular expressions as a key - you'll just need to select 'Yes' in the input 'Allow regular expressions?' if you want to use one.
Slice Text
This action requires a decent understanding of the nature of the numbering of characters in a text string. Just remember that the first character is always numbered '1', and every character - letters, number, spaces, punctuation - are counted.
We'll give the text that we want to slice in the first input, like all the other methods here.
In the second input, 'Start Type' allows you to specify either 'Character' or String'. Start Type 'Character' starts the slice at the character position you specify below (The first character has position '1'). 'Text' will use the character immediately after the first occurrence of the given string.
You can then specify the 'Start', which will take input of a number if you selected 'Character', or a set of characters, a word, or a 'string' if you selected 'Test' above. You can leave this blank, which means that the search will start at the beginning of the string - which we know is Character number '1'.
'End Type' and 'End' then function in the same way, but obviously for the opposite end of the text.
An example, using our Hello world. How are you? in the first 'Text' input and then in the following fields:
'Start Type': Text
'Start': Hello
'End Type': Text
'End': you
Will yield this result:
ello world. How are
A quick test! How may characters are in that text? You' be tempted to say 19 - but when we split at the you? we slice right at the letter y - so there's a trailing white space here which takes the character count to a nice round 20.
ello world. How are <---- There's still a space at the end here!
Split Text
A useful and simple action that is the opposite of 'Join Text'. Instead of giving many inputs and returning a single one, you'll give a single input and (sometimes) return many outputs.
As always you'll give your text in the first input: hello world. how are you?
In the second input, 'Separator' you need to define at what type of character your text should be split. Assuming we give the separator . (a full stop).
Doing so in our example would return two outputs:
- hello world
- how are you
You should note that in output number 2 here, there is actually a leading space - the space is of course counted as a character.
Truncate Text
This is a really straightforward action that follows the same important principles as 'Get Length' in terms of the total character count of the text we give.
After giving the first input, our string of hello world. how are you? I then need to give a length in our second input. This should just be a number, like '5'.
Doing that in this case would return as an output hello
Let us know how we can improve Flow XO on our feedback site.