Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

String literal example:

STARTSWITH
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
startswith(FullName,'Mr.')

startswith(FullName,'Mr.')

Output:

...

Returns true if the first three letters of the FullName column value are "Mr.". 

D s item
itempattern
 example:

STARTSWITH
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
startswith(CustId,`{alpha-numeric}{6}`) as:'validateCustId'

...

startswith(CustId,`{alpha-numeric}{6}`)

Output: Returns true if the CustId column begins with a six-digit alpha-numeric sequence. Otherwise,

...

the value is set to false.

Regular expression pattern example:

IFSTARTSWITH,phone,
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextset col:Status value:
if(
startswith(phone,/^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/),'phone - ok','phone - error')

if(startswith(phone,/^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/),'phone - ok','phone - error')

Output:

...

 Returns phone - ok if the value of the phone column begins with a value that matches a 10-digit U.S. phone number. Otherwise,

...

the output value is set to phone - error.

D s
snippetSyntax

STARTSWITH
d-codelang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:
startswith(column_any,pattern)

startswith(column_any,pattern)


ArgumentRequired?Data TypeDescription
column_anyYanyName of the column to be applied to the function
patternYstringPattern or literal expressed as a string describing the pattern to which to match.

...