Similar to date operators, string operators are used when we want to transform our data from one stage of the pipeline to the next one. Potential use cases include pre-processing text fields to extract relevant information to be used in later stages of our pipeline.
- $concat: This is used to concatenate strings.
- $split: This is used to split strings based on delimiter. If the delimiter is not found, the original string is returned.
- $strcasecmp: This is used in case-insensitive string comparison; 0 if strings are equal, 1 if the first string is great, otherwise -1.
- $toLower / $toUpper: This is used to convert string to all lowercase or all uppercase respectively.
- $indexOfBytes: This is used to return the Byte occurrence of the first occurrence of a substring in a string.
- $strLenBytes: This is the number of bytes in the input string.
- $substrBytes: This returns the specified bytes of the substring.
The equivalent methods for code points (a value in unicode, regardless of the underlying bytes in its representation) are:
- $indexOfCP
- $strLenCP
- $substrCP