startsWith

Returns true if the first string element in the variable begins with the specified character sequence; otherwise, returns false. You can also use the offset parameter to specify at what position in the variable you want to begin looking.

Note: The startsWith string method is case sensitive.

Syntax:

$[ScriptVariable]::startsWith(String prefix[, int offset])

Parameters:

Example:

The following example illustrates the syntax for the startsWith string method:

$str = "Hello World"

$start = $str::startsWith("World", 6)

print($start)

Output:

true