String.startsWith()

Signature

boolean startsWith (String s1, String prefix)

Domain

action, condition

Description

Tests if the String s1 starts with the specified prefix.

Parameters

NameTypeDescription
s1StringA String to test for the presence of the prefix.
prefixStringA prefix String to test for in the String s1.

Returns

TypeDescription
booleantrue if s1 starts with prefix, false otherwise.

Cautions

none

Example


boolean result = String.startsWith ("This is a test", "test");

Result is:
result contains: false