Returns |
STARTSWITH
function is ideal for matching based on patterns for any data type. If you need to match strings using a fixed number of characters, you should use the LEFT
function instead. See LEFT Function.String literal example:
derive type:single value:STARTSWITH(FullName,'Mr.') |
Output: Writes true
into a new column if the first three letters of the FullName
column value are "Mr.".
example:
derive type:single value:STARTSWITH(CustId,`{alpha-numeric}{6}`) as:'validateCustId' |
Output: Generates the validateCustId
column containing true
if the CustId
column begins with a six-digit alpha-numeric sequence. Otherwise, the validateCustId
column is set to false
.
Regular expression pattern example:
set col:Status value:IF(STARTSWITH,phone,/^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/),'phone - ok','phone - error') |
Output: Sets the value in the Status
column to phone - ok
if the value of the phone
column begins with a value that matches a 10-digit U.S. phone number. Otherwise, the Status
column is set to phone - error
.
derive type:single value:STARTSWITH(column_any,pattern) |
Argument | Required? | Data Type | Description |
---|---|---|---|
column_any | Y | any | Name of the column to be applied to the function |
pattern | Y | string | Pattern or literal expressed as a string describing the pattern to which to match. |
Name of the column to be searched.
Required? | Data Type | Example Value |
---|---|---|
Yes | Column reference | myColumn |
, regular expression, or string literal to locate in the values in the specified column.
Required? | Data Type | Example Value |
---|---|---|
Yes | String | `{zip}` |