@linkdotnet/stringoperations
Version:
Collection of string utilities. Edit-Distances, Search and Data structures. Offers for example trie, levenshtein distance.
18 lines (17 loc) • 938 B
TypeScript
/**
* Checks whether 'text' has an occurrence of 'word'
* @param text Text to look for the occurrences of 'word'
* @param word Word to look for in 'text'
* @param ignoreCase Ignore case, when comparing each character
* @returns Returns true, if an occurence was found otherwise false
*/
export declare function contains(text: string, word: string, ignoreCase?: boolean): boolean;
/**
* Finds all occurences of 'word' in 'text' and returns the indexes
* @param text Text to look for the occurrences of 'word'
* @param word Word to look for in 'text'
* @param ignoreCase Ignore case, when comparing each character
* @param abortOnFirstOccurrence If set to true, findAll will only return the first index instead of all
* @returns Array of indexes. Empty if no occurrence was found
*/
export declare function findAll(text: string, word: string, ignoreCase?: boolean, abortOnFirstOccurrence?: boolean): number[];