Return to String Function Index
String Function Syntax and Examples
The MID() function returns a specified number of characters from a string.
Syntax:
MID(string,start-position[,length])
where:
- start-position is the character position within the string (counting left to right) at which the portion to be returned begins. If start-position is greater than the string length, an empty string ('', length=0) is returned.
- The optional length argument is the number of characters to be taken from the string. If length is not included among the arguments, is a negative value, or is a value greater than the length of the substring from start-position to the end of the string, the entire field from start-position to the end of the field is returned.
Example:input: samplestring
IMPORT @sample.dat
{RECORD
{
field1 *\r\n
}
schema1.table1
{
col1 MID(field1,2,3)
col2 MID(field1,15,4)
col3 MID(field1,7,31)
col4 MID(field1,7,-1)
}}
Results:
schema1.table1.col1 amp schema1.table1.col2 ''
(empty string, length =0)schema1.table1.col3 string schema1.table1.col4 string
Return to String Function Index