Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
There also exist algebraic operators (+, -, *, /) to perform string concatenation and deletion.
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT "Hello"+"World" FROM Stream
=> "HelloWorld"
SELECT "HelloWorld"-"World" FROM Stream
=> "Hello"
SELECT "HelloWorld"*3 FROM Stream
=> "HelloWorldHelloWorldHelloWorld"
SELECT "HelloWorldHelloWorldHelloWorld"/"World" FROM Stream
=> 3 |
Concat(String s1, String s2)
Returns a new string that is a concatenating the arguments.
SubString(String s,
...
Number begin,
...
Number end)
Returns a new string that is a substring of the value with given begin and end index
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT substring("Hello World",1,3) FROM Stream
=> "el" |
SubString(String s, Number begin)
Returns a new string that is a substring of the value starting at the begin index until the end of the string
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT substring("Hello World",1) FROM Stream
=> "ello World" |
Length(String s)
Returns the length of a string.
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT length("Hello") FROM Stream
=> 5 |
Upper(String s)
Returns the string converted to uppercase.
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT upper("Hello World") FROM Stream
=> "HELLO WORLD" |
Lower(String s)
Returns the string converted to lowercase.
Code Block | ||||
---|---|---|---|---|
| ||||
SELECT lower("Hello World") FROM Stream
=> "hello world" |
Parsing of Strings
The most functions provide one return value. Sometimes it is needed to split an incoming attribute to multiple values
split(String s, String delimiter, Number index)
This function returns number (third parameter) strings from the input string (first parameter) with the delimiter (second parameter).
Code Block | ||
---|---|---|
| ||
SELECT split(input,",",3) FROM stream |
Remark: There is no way to parse different types with this function. Each incoming string must contains exactly the given numbers of inputs.
Table of Contents |
---|