String to examine the start of, or single character.
String of characters to look for in the start of haystack, or a single character.
true if the first character of haystack is also in needles, false if not.
assert("#channel".beginsWithOneOf("#%+")); assert(!"#channel".beginsWithOneOf("~%+")); assert("".beginsWithOneOf("")); assert("abc".beginsWithOneOf(string.init)); assert(!"".beginsWithOneOf("abc")); assert("abc".beginsWithOneOf('a')); assert(!"abc".beginsWithOneOf('b')); assert(!"abc".beginsWithOneOf(char.init)); assert('#'.beginsWithOneOf("#%+")); assert(!'#'.beginsWithOneOf("~%+")); assert('a'.beginsWithOneOf(string.init)); assert(!'d'.beginsWithOneOf("abc"));
Checks whether or not the first letter of a string begins with any of the passed string of characters, or single character.
Merely slices; does not decode the string and may thus give weird results on weird inputs.