UNPKG

@igorskyflyer/chars-in-string

Version:

🪐 Determines whether an array of chars is present inside a given String. ☄

26 lines (25 loc) 1.61 kB
export declare enum Position { Any = 0, Start = 1, End = 2 } /** * Returns whether any of the characters defined in the array are present inside the given String. * @public * @param {string[]} characters the characters to search for, expects a single character per entry, if multiple are found it will take the first one, * @param {string} input the String which needs to be checked, * @param {Position} [position=Position.Any] controls where the matching should occur, at the **beginning** of the `String`, at the **end** or **anywhere** (default), * @param {boolean} [caseSensitive=true] controls whether the search is case-sensitive, defaults to true, * @returns {boolean} returns true upon first match, false if no matches are found. */ export declare function charsInString(characters: string[], input: string, position?: Position, caseSensitive?: boolean): boolean; /** * Returns whether any of the Strings defined in the array are present inside the given String. * @public * @param {string[]} strings the strings to search for, * @param {string} input the String which needs to be checked, * @param {Position} [position=Position.Any] controls where the matching should occur, at the **beginning** of the `String`, at the **end** or **anywhere** (default), * @param {boolean} [caseSensitive=true] controls whether the search is case-sensitive, defaults to true, * @returns {boolean} returns true upon first match, false if no matches are found. */ export declare function stringsInString(strings: string[], input: string, position?: Position, caseSensitive?: boolean): boolean;