# startsWith {#startswith}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`startsWith(X, str)`

## Arguments {#arguments}

**X** is a string scalar/vector.

**str** is a string scalar.

## Details {#details}

Check if *X* starts with *str*. If yes, return true; otherwise return false.

## Examples {#examples}

```
str1="US product"
str2="UK product"
if (startsWith(str1, "US")) print "str1 is a US product."
else print "str1 is not a US product."
if (startsWith(str2, "US")) print "str2 is a US product."
else print "str2 is not a US product.";

/* output:
str1 is a US product.
str2 is not a US product.
*/
```

