As of July 2022, it is now possible to use string functions in your feed rules in GoDataFeed. String functions are used in computer programming languages to manipulate a string or query information about a string.
To apply a String function you would begin by creating a rule within one of the feeds and updating the TO section in your rule to use one of the functions listed below. String functions must end with the tag "}}" like the below example:
It is also possible to use string functions within one another
See the available string functions below that you can use within GoDataFeed when setting up your feed.
Case Functions
Function | Description | Usage in rule | Example: thiS is THe eXaMpLe |
UPPER_CASE | Make all characters uppercase | UPPER_CASE{{ | THIS IS THE EXAMPLE |
LOWER_CASE | Make all characters lowercase | LOWER_CASE{{ | this is the example |
CAPITAL_CASE | Make the first letter of every word capital | CAPITAL_CASE{{ | This Is The Example |
SENTENCE_CASE | Make only the first word capital | SENTENCE_CASE{{ | This is the example |
Split Functions
Function | Description | Usage in rule | Example: hello,world |
SPLIT | First we split the data based on a character. For example, split using a comma. Next, select the data by position. For example, return index 0 after the split. | SPLIT(,)[0]{{ | hello |
Substring Functions
Function | Description | Usage in rule | Example: hello,world |
SUBSTRING | Return a substring starting and ending at the index. If no ending index is provided the substring will continue to the end | SUBSTRING(4){{ SUBSTRING(4,8){{ |
o,world o,wo |
SUBSTRING_LEFT | Return a substring starting at 0 until the index | SUBSTRING_LEFT(4){{ | hello |
SUBSTRING_RIGHT | Return a substring starting from the end minus the index | SUBSTRING_RIGHT(5){{ | world |
Count Functions
Function | Description | Usage in rule | Example: hello hello |
COUNT_LENGTH | Returns the length of the value | COUNT_LENGTH{{ | 11 |
COUNT_STRING | Returns the occurrences of a value | COUNT_STRING(hello){{ | 2 |
Format Functions
Note: When a Format-based string function is used it rounds decimal places when implemented.
Function | Description | Usage in rule (see link to an example article) | Examples |
FORMAT_DATE | Format a date type value |
FORMAT_DATE(:d){{ |
19-03-2021 19 March 2021 06:49:20 06:49:20 19 March 2021 06:49:00 19-03-2021 06:49:44 March 19 Thu, 19 March 2021 06:49:22 GMT 2021-03-19T06:49:11 2021-03-19 06:49:49Z 19 March 2021 00:18:55 March, 2021 |
FORMAT_NUMBER | Format a number type value | FORMAT_NUMBER(:f){{ FORMAT_NUMBER(:e){{ FORMAT_NUMBER(:g){{ FORMAT_NUMBER(:n){{ FORMAT_NUMBER(:00.00){{ FORMAT_NUMBER(:0.000){{ FORMAT_NUMBER(:0,0){{ FORMAT_NUMBER(:0.0){{ FORMAT_NUMBER(:0%){{ |
55674.74 5.567474e+004 55674.73789621 55,674.74 55674.74 55674.738 55,675 55,675.7 5567474% |
Trim Functions
Function | Description | Usage in rule | Example: hello worldh |
TRIM | Trim whitespace or character from the beginning and ending | TRIM{{ TRIM(h){{ |
hello worldh ello world |
TRIM_LEFT | Trim whitespace or character from the beginning | TRIM_LEFT{{ TRIM_LEFT(h){{ |
hello worldh ello worldh |
TRIM_RIGHT | Trim whitespace or character from the ending | TRIM_RIGHT{{ TRIM_RIGHT(h){{ |
hello worldh hello world |
Encoding Functions
Function | Description | Usage in rule | Example: https://google.com?a=test&b=test |
ENCODE_SHA256 | Apply SHA256 hash to a value. | ENCODE_SHA256{{ | F6902E2089478604307C194855F0896D5124D2EF EF134894447F9139C627B91B |
ENCODE_BASE64 | Encode a value in Base64 | ENCODE_BASE64{{ | aHR0cHM6Ly9nb29nbGUuY29tP2E9dGVzdCZiPXRlc3Q= |
ENCODE_URL | URL encode a value | ENCODE_URL{{ | https%3A%2F%2Fgoogle.com%3Fa%3Dtest%26b%3Dtest |
ENCODE_HTML | HTML encode a value | ENCODE_HTML{{ | https://google.com?a=test&b=test |
DECODE_BASE64 | Decode a value in Base64 | DECODE_BASE64{{ | https://google.com?a=test&b=test |
DECORD_URL | URL decode a value | DECODE_URL{{ | https://google.com?a=test&b=test |
DECODE_HTML | HTML decode a value | DECODE_HTML{{ | https://google.com?a=test&b=test |
Related to
Comments
0 comments
Please sign in to leave a comment.