当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript strings.compareIgnoreCase函数代码示例

本文整理汇总了TypeScript中vs/base/common/strings.compareIgnoreCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript compareIgnoreCase函数的具体用法?TypeScript compareIgnoreCase怎么用?TypeScript compareIgnoreCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compareIgnoreCase函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: defaultComparator

function defaultComparator(a: ISuggestionItem, b: ISuggestionItem): number {

	let ret = 0;

	// check with 'sortText'
	if (typeof a.suggestion.sortText === 'string' && typeof b.suggestion.sortText === 'string') {
		ret = compareIgnoreCase(a.suggestion.sortText, b.suggestion.sortText);
	}

	// check with 'label'
	if (ret === 0) {
		ret = compareIgnoreCase(a.suggestion.label, b.suggestion.label);
	}

	// check with 'type' and lower snippets
	if (ret === 0 && a.suggestion.type !== b.suggestion.type) {
		if (a.suggestion.type === 'snippet') {
			ret = 1;
		} else if (b.suggestion.type === 'snippet') {
			ret = -1;
		}
	}

	return ret;
}
开发者ID:SeanKilleen,项目名称:vscode,代码行数:25,代码来源:suggest.ts

示例2: areSameExtensions

export function areSameExtensions(a: IExtensionIdentifier, b: IExtensionIdentifier): boolean {
	if (a.uuid && b.uuid) {
		return a.uuid === b.uuid;
	}
	if (a.id === b.id) {
		return true;
	}
	return compareIgnoreCase(a.id, b.id) === 0;
}
开发者ID:ramesius,项目名称:vscode,代码行数:9,代码来源:extensionManagementUtil.ts


注:本文中的vs/base/common/strings.compareIgnoreCase函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。