Contact Us 1-800-596-4880

startsWith

startsWith(text: String, prefix: String): Boolean

Returns true or false depending on whether the input string starts with a matching prefix.

Parameters

Name Description

text

The input string.

prefix

A string that identifies the prefix.

Example

This example indicates whether the strings start with a given prefix. Note that you can use the startsWith(text,prefix) or text startsWith(prefix) notation (for example, startsWith("Mari","Mar") or "Mari" startsWith("Mar")).

Source

%dw 2.0
output application/json
---
[ "Mari" startsWith("Mar"), "Mari" startsWith("Em") ]

Output

[ true, false ]

startsWith(text: Null, prefix: Any): false

Helper function that enables startsWith to work with a null value.

Introduced in DataWeave version 2.4.0.