本文整理汇总了TypeScript中@ephox/katamari.Strings.contains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Strings.contains方法的具体用法?TypeScript Strings.contains怎么用?TypeScript Strings.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Strings
的用法示例。
在下文中一共展示了Strings.contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const charMatches = (charCode: number, name: string, lowerCasePattern: string): boolean => {
if (Strings.contains(String.fromCharCode(charCode).toLowerCase(), lowerCasePattern)) {
return true;
} else {
return Strings.contains(name.toLowerCase(), lowerCasePattern) || Strings.contains(name.toLowerCase().replace(/\s+/g, ''), lowerCasePattern);
}
};
示例2:
const getTextComponents = (): SimpleSpec[] => {
const components: SimpleSpec[] = [];
if (editor.getParam('elementpath', true, 'boolean')) {
components.push(ElementPath.renderElementPath(editor, { }));
}
if (Strings.contains(editor.settings.plugins, 'wordcount')) {
components.push(renderWordCount(editor, providersBackstage));
}
if (editor.getParam('branding', true, 'boolean')) {
components.push(renderBranding());
}
if (components.length > 0) {
return [{
dom: {
tag: 'div',
classes: [ 'tox-statusbar__text-container']
},
components,
}];
}
return [];
};
示例3: if
const getResizeType = (editor): ResizeTypes => {
// If autoresize is enabled, disable resize
const fallback = !Strings.contains(editor.settings.plugins, 'autoresize');
const resize = editor.getParam('resize', fallback);
if (resize === false) {
return ResizeTypes.None;
} else if (resize === 'both') {
return ResizeTypes.Both;
} else {
return ResizeTypes.Vertical;
}
};
示例4:
const hasNbsp = (pos: CaretPosition) => {
const container = pos.container();
return NodeType.isText(container) && Strings.contains(container.data, nbsp);
};
示例5:
return RgbaColour.fromString(currentRgb).map((rgba) => {
const currentHex = HexColour.fromRgba(rgba).value();
// note: value = '#FFFFFF', currentHex = 'ffffff'
return Strings.contains(value.toLowerCase(), currentHex);
});
示例6:
return Strings.contains(emoji.title.toLowerCase(), lowerCasePattern) || Arr.exists(emoji.keywords, (k) => Strings.contains(k.toLowerCase(), lowerCasePattern));