Returns a string that consists of the words that are sorted alphabetically.
Category: | String |
Returned data type: | String |
Note: | Special characters such as ",.!" are not treated as separation characters. |
SORT_WORDS(source<,ascending,remove_duplicates>)
source
specifies a string to sort; this can be specified as string constant, field name, or expression
Note: If source is NULL, the function returns a NULL value.
ascending
specifies whether the text should be sorted in ascending order; this can be specified as Boolean constant, field name, or expression. The value must evaluate to either TRUE or FALSE:
TRUE | the input string is sorted in ascending order | |
FALSE | the input string is sorted in descending order | |
Default | TRUE |
remove_duplicates
specifies whether duplicate characters should be removed; this can be specified as Boolean constant, field name, or expression. The value must evaluate to either TRUE or FALSE:
TRUE | duplicate characters are removed | |
FALSE | duplicate characters are not removed | |
Default | FALSE |
In determining the order, words with initial capital letters precede lowercase letters. Also, words with a concatenated special character are treated as a different word. For example, first and first! are two different words.
source_string =
"It's a first! This is the first time I came in first place!"
ascending = true
remove_duplicates = true
result = sort_words(source_string, ascending, remove_duplicates)
// outputs "I It's This a came first first! in is place! the time"