Returns true if this string starts with a match of pattern.
var string = 'Dart';
string.startsWith('D'); // true
string.startsWith(new RegExp(r'[A-Z][a-z]')); // true
If index is provided, this method checks if the substring starting at that index starts with a match of pattern:
string.startsWith('art', 1); // true
string.startsWith(new RegExp(r'\w{3}')); // true
index must not be negative or greater than length.
A RegExp containing '^' does not match if the index is greater than zero. The pattern works on the string as a whole, and does not extract a substring starting at index first:
string.startsWith(new RegExp(r'^art'), 1); // false
string.startsWith(new RegExp(r'art'), 1); // true