public class Strings extends Object
ScalarValuedFunction
,
DeriveFields
Modifier and Type | Class and Description |
---|---|
static class |
Strings.NullConcatenation
Specifies behavior of null values for string concatenation.
|
Constructor and Description |
---|
Strings() |
Modifier and Type | Method and Description |
---|---|
static ScalarValuedFunction |
concat(List<ScalarValuedFunction> exprs)
Builds a function returning a concatenation of the string
representations of the evaluated expressions.
|
static ScalarValuedFunction |
concat(ScalarValuedFunction... exprs)
Builds a function returning a concatenation of the string
representations of the evaluated expressions.
|
static ScalarValuedFunction |
concat(Strings.NullConcatenation nullHandling,
List<ScalarValuedFunction> exprs)
Builds a function returning a concatenation of the string
representations of the evaluated expressions.
|
static ScalarValuedFunction |
concat(Strings.NullConcatenation nullHandling,
ScalarValuedFunction... exprs)
Builds a function returning a concatenation of the string
representations of the evaluated expressions.
|
static ScalarValuedFunction |
find(ScalarValuedFunction value,
String pattern)
Builds a function returning the first index of the substring
that matches the provided pattern in the string value to which the
specified expression evaluates.
|
static ScalarValuedFunction |
find(String field,
String pattern)
Builds a function returning the first index of the substring
that matches the provided pattern in the specified string field.
|
static ScalarValuedFunction |
indexOf(ScalarValuedFunction value,
ScalarValuedFunction string)
Builds a function returning the first index of the specified string
that occurs in the string value to which the specified expression
evaluates.
|
static ScalarValuedFunction |
indexOf(ScalarValuedFunction value,
String str)
Builds a function returning the first index of the specified string
that occurs in the string value to which the specified expression
evaluates.
|
static ScalarValuedFunction |
indexOf(String field,
String str)
Builds a function returning the first index of the specified substring
in the specified string field.
|
static ScalarValuedFunction |
lastIndexOf(ScalarValuedFunction value,
ScalarValuedFunction string)
Builds a function returning the last index of the specified string
that occurs in the string value to which the specified expression
evaluates.
|
static ScalarValuedFunction |
lastIndexOf(ScalarValuedFunction value,
String str)
Builds a function returning the last index of the specified string
that occurs in the string value to which the specified expression
evaluates.
|
static ScalarValuedFunction |
lastIndexOf(String field,
String str)
Builds a function returning the last index of the specified substring
in the specified string field.
|
static ScalarValuedFunction |
length(ScalarValuedFunction expr)
Builds a function returning the length of the string value
to which the given expression evaluates.
|
static ScalarValuedFunction |
length(String field)
Builds a function returning the length of the string value
in the specified field.
|
static ScalarValuedFunction |
mid(ScalarValuedFunction expr,
int index,
int length)
Builds a function returning a substring of the string
value to which the specified expression evaluates.
|
static ScalarValuedFunction |
mid(ScalarValuedFunction expr,
int index,
ScalarValuedFunction length)
Builds a function returning a substring of the string
value to which the specified expression evaluates.
|
static ScalarValuedFunction |
mid(ScalarValuedFunction expr,
ScalarValuedFunction index,
int length)
Builds a function returning a substring of the string
value to which the specified expression evaluates.
|
static ScalarValuedFunction |
mid(ScalarValuedFunction expr,
ScalarValuedFunction index,
ScalarValuedFunction length)
Builds a function returning a substring of the string
value to which the specified expression evaluates.
|
static ScalarValuedFunction |
mid(String field,
int index,
int length)
Builds a function returning a substring of the string
value in the specified field.
|
static ScalarValuedFunction |
replaceAll(ScalarValuedFunction value,
String pattern,
ScalarValuedFunction replacement)
Builds a function replacing all occurrences of a given pattern
in the result of a specified expression.
|
static ScalarValuedFunction |
replaceAll(ScalarValuedFunction value,
String pattern,
String replacement)
Builds a function replacing all occurrences of a given pattern
in the result of a specified expression.
|
static ScalarValuedFunction |
replaceAll(String field,
String pattern,
String replacement)
Builds a function replacing all occurrences of a given pattern
in the specified field value.
|
static ScalarValuedFunction |
replaceFirst(ScalarValuedFunction value,
String pattern,
ScalarValuedFunction replacement)
Builds a function replacing the first occurrence of a given pattern
in the result of a specified expression.
|
static ScalarValuedFunction |
replaceFirst(ScalarValuedFunction value,
String pattern,
String replacement)
Builds a function replacing the first occurrence of a given pattern
in the result of a specified expression.
|
static ScalarValuedFunction |
replaceFirst(String field,
String pattern,
String replacement)
Builds a function replacing the first occurrence of a given pattern
in the specified field value.
|
static ScalarValuedFunction |
substr(ScalarValuedFunction expr,
int start)
Builds a function returning a substring of the string
value to which the specified expression evaluates, starting at
a specified index.
|
static ScalarValuedFunction |
substr(ScalarValuedFunction expr,
int start,
int end)
Builds a function returning a substring of the string
value to which the specified expression evaluates, between
specified indexes.
|
static ScalarValuedFunction |
substr(ScalarValuedFunction expr,
ScalarValuedFunction start)
Builds a function returning a substring of the string
value to which the specified expression evaluates, starting at
a specified index.
|
static ScalarValuedFunction |
substr(ScalarValuedFunction expr,
ScalarValuedFunction start,
ScalarValuedFunction end)
Builds a function returning a substring of the string
value to which the specified expression evaluates, between
specified indexes.
|
static ScalarValuedFunction |
substr(String field,
int start)
Builds a function returning a substring of the string
value in the specified field, starting at a specified index.
|
static ScalarValuedFunction |
substr(String field,
int start,
int end)
Builds a function returning a substring of the string
value in the specified field, between specified indexes.
|
static ScalarValuedFunction |
toLowerCase(ScalarValuedFunction expr)
Builds a function returning the lower case string value
of the string to which the given expression evaluates.
|
static ScalarValuedFunction |
toLowerCase(String field)
Builds a function returning the lower case string value
in the specified field.
|
static ScalarValuedFunction |
toUpperCase(ScalarValuedFunction expr)
Builds a function returning the upper case string value
of the string to which the given expression evaluates.
|
static ScalarValuedFunction |
toUpperCase(String field)
Builds a function returning the upper case string value
in the specified field.
|
static ScalarValuedFunction |
trim(ScalarValuedFunction expr)
Builds a function returning the whitespace trimmed string value
of the string to which the given expression evaluates.
|
static ScalarValuedFunction |
trim(String field)
Builds a function returning the whitespace trimmed string value
in the specified field.
|
public static ScalarValuedFunction length(String field)
null
, the return length is also null
.field
- the record field value on which to calculate
the string lengthpublic static ScalarValuedFunction length(ScalarValuedFunction expr)
null
, the return length is also null
.expr
- the expression producing the string valuepublic static ScalarValuedFunction trim(String field)
null
, the result is null
.field
- the record field value to trimpublic static ScalarValuedFunction trim(ScalarValuedFunction expr)
null
, the result is null
.expr
- the expression producing the string value to trimpublic static ScalarValuedFunction toUpperCase(String field)
null
, the result is null
.field
- the record field value to convert to upper casepublic static ScalarValuedFunction toUpperCase(ScalarValuedFunction expr)
null
, the result is null
.expr
- the expression producing the string value to cast to upper casepublic static ScalarValuedFunction toLowerCase(String field)
null
, the result is null
.field
- the record field value to convert to lower casepublic static ScalarValuedFunction toLowerCase(ScalarValuedFunction expr)
null
, the result is null
.expr
- the expression producing the string value to cast to lower casepublic static ScalarValuedFunction substr(String field, int start)
The result will be null
if the input string is null
.
field
- the record field from which to get a substringstart
- the beginning index of the substring, inclusive.
The substring includes all characters up to the end of the string.public static ScalarValuedFunction substr(String field, int start, int end)
The result will be null
if the input string is null
.
If the start index is greater than the end index, the result is the
empty string.
field
- the record field value from which to get a substringstart
- the beginning index of the substring, inclusiveend
- the ending index of the substring, exclusive. If the end
index is beyond the end of the string, the substring will be taken up
to the end of the string.public static ScalarValuedFunction substr(ScalarValuedFunction expr, int start)
The result will be null
if the input string is null
.
expr
- a string expression from which to get a substringstart
- the beginning index of the substring, inclusive.
The substring includes all characters up to the end of the string.public static ScalarValuedFunction substr(ScalarValuedFunction expr, int start, int end)
The result will be null
if the input string is null
.
If the start index is greater than the end index, the result is the
empty string.
expr
- a string expression from which to get a substringstart
- the beginning index of the substring, inclusiveend
- the ending index of the substring, exclusive. If the end
index is beyond the end of the string, the substring will be taken up
to the end of the string.public static ScalarValuedFunction substr(ScalarValuedFunction expr, ScalarValuedFunction start)
The result will be null
if the input string is null
.
expr
- a string expression from which to get a substringstart
- an integer expression for the beginning index of the
substring, inclusive. The substring includes all characters up
to the end of the string.public static ScalarValuedFunction substr(ScalarValuedFunction expr, ScalarValuedFunction start, ScalarValuedFunction end)
The result will be null
if the input string is null
.
If the start index is greater than the end index, the result is the
empty string.
expr
- a string expression from which to get a substringstart
- an integer expression for the beginning index of the
substring, inclusiveend
- an integer expression for the ending index of the
substring, exclusive. If the result is beyond the end of the
string, the substring will be taken up to the end of the string.public static ScalarValuedFunction mid(String field, int index, int length)
The result will be null
if the input string is null
.
If the length is negative the result will be an empty string.
field
- the record field value from which to get a substringindex
- the beginning index of the substringlength
- the number of characters to include in the substring
including the initial character at the indexpublic static ScalarValuedFunction mid(ScalarValuedFunction expr, int index, int length)
The result will be null
if the input string is null
.
If the length is negative the result will be an empty string.
expr
- a string expression from which to get a substringindex
- the beginning index of the substringlength
- the number of characters to include in the substring
including the initial character at the indexpublic static ScalarValuedFunction mid(ScalarValuedFunction expr, ScalarValuedFunction index, int length)
The result will be null
if the input string is null
.
If the length is negative the result will be an empty string.
expr
- a string expression from which to get a substringindex
- an integer expression for the beginning index of the substringlength
- the number of characters to include in the substring
including the initial character at the indexpublic static ScalarValuedFunction mid(ScalarValuedFunction expr, int index, ScalarValuedFunction length)
The result will be null
if the input string is null
.
If the length is negative the result will be an empty string.
expr
- a string expression from which to get a substringindex
- the beginning index of the substringlength
- an integer expression for the number of characters to
include in the substring including the initial character at the indexpublic static ScalarValuedFunction mid(ScalarValuedFunction expr, ScalarValuedFunction index, ScalarValuedFunction length)
The result will be null
if the input string is null
.
If the length is negative the result will be an empty string.
expr
- a string expression from which to get a substringindex
- an integer expression for the beginning index of the substringlength
- an integer expression for the number of characters to
include in the substring including the initial character at the indexpublic static ScalarValuedFunction concat(ScalarValuedFunction... exprs)
Conversions.toText(String, java.text.Format)
.
Null-valued arguments are ignored; this is equivalent to treating
them as the empty string. To control behavior for
null use concat(NullConcatenation, ScalarValuedFunction...)
.exprs
- expressions from which to concatenate valuespublic static ScalarValuedFunction concat(List<ScalarValuedFunction> exprs)
Conversions.toText(String, java.text.Format)
.
Null-valued arguments are ignored; this is equivalent to treating
them as the empty string. To control behavior for
null use concat(NullConcatenation, List)
.exprs
- expressions from which to concatenate valuespublic static ScalarValuedFunction concat(Strings.NullConcatenation nullHandling, ScalarValuedFunction... exprs)
Conversions.toText(String, java.text.Format)
.
Null-valued arguments arenullHandling
- indicates how to deal with null-valued argumentsexprs
- expressions from which to concatenate valuespublic static ScalarValuedFunction concat(Strings.NullConcatenation nullHandling, List<ScalarValuedFunction> exprs)
Conversions.toText(String, java.text.Format)
.nullHandling
- indicates how to deal with null-valued argumentsexprs
- expressions from which to concatenate valuespublic static ScalarValuedFunction replaceAll(String field, String pattern, String replacement)
field
- the record field value on which to perform replacementpattern
- a regular expression describing the pattern to replacereplacement
- the value with which to replace any matchespublic static ScalarValuedFunction replaceAll(ScalarValuedFunction value, String pattern, String replacement)
value
- a string expression on which to perform pattern replacementpattern
- a regular expression describing the pattern to replacereplacement
- the value with which to replace any matchespublic static ScalarValuedFunction replaceAll(ScalarValuedFunction value, String pattern, ScalarValuedFunction replacement)
value
- a string expression on which to perform pattern replacementpattern
- a regular expression describing the pattern to replacereplacement
- a string expression with which to replace any matchespublic static ScalarValuedFunction replaceFirst(String field, String pattern, String replacement)
field
- the record field value on which to perform replacementpattern
- a regular expression describing the pattern to replacereplacement
- the value with which to replace any matchespublic static ScalarValuedFunction replaceFirst(ScalarValuedFunction value, String pattern, String replacement)
value
- a string expression on which to perform pattern replacementpattern
- a regular expression describing the pattern to replacereplacement
- the value with which to replace any matchespublic static ScalarValuedFunction replaceFirst(ScalarValuedFunction value, String pattern, ScalarValuedFunction replacement)
value
- a string expression on which to perform pattern replacementpattern
- a regular expression describing the pattern to replacereplacement
- a string expression with which to replace any matchespublic static ScalarValuedFunction indexOf(String field, String str)
field
- the record field value to search for the stringstr
- the string to search forpublic static ScalarValuedFunction indexOf(ScalarValuedFunction value, String str)
value
- the expression producing the string valuestr
- the string to search forpublic static ScalarValuedFunction indexOf(ScalarValuedFunction value, ScalarValuedFunction string)
value
- the expression producing the string valuestring
- the string to search forpublic static ScalarValuedFunction lastIndexOf(String field, String str)
field
- the record field value to search for the stringstr
- the string to search forpublic static ScalarValuedFunction lastIndexOf(ScalarValuedFunction value, String str)
value
- the expression producing the string valuestr
- the string to search forpublic static ScalarValuedFunction lastIndexOf(ScalarValuedFunction value, ScalarValuedFunction string)
value
- the expression producing the string valuestring
- the string to search forpublic static ScalarValuedFunction find(String field, String pattern)
field
- the record field value to search for the stringpattern
- a regular expression describing the pattern to search forpublic static ScalarValuedFunction find(ScalarValuedFunction value, String pattern)
value
- the expression producing the string valuepattern
- a regular expression describing the pattern to search forCopyright © 2020 Actian Corporation. All rights reserved.