本文整理了Java中com.ibm.icu.text.Collator.getCollationKey()
方法的一些代码示例,展示了Collator.getCollationKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collator.getCollationKey()
方法的具体详情如下:
包路径:com.ibm.icu.text.Collator
类名称:Collator
方法名:getCollationKey
[英]Transforms the String into a CollationKey suitable for efficient repeated comparison. The resulting key depends on the collator's rules, strength and decomposition mode.
Note that collation keys are often less efficient than simply doing comparison. For more details, see the ICU User Guide.
See the CollationKey class documentation for more information.
[中]将字符串转换为适合高效重复比较的排序规则键。生成的关键点取决于拼贴器的规则、强度和分解模式。
请注意,排序键的效率通常低于简单地进行比较。有关更多详细信息,请参阅ICU用户指南。
有关更多信息,请参阅CollationKey类文档。
代码示例来源:origin: com.ibm.icu/icu4j-localespi
@Override
public CollationKey getCollationKey(String source) {
com.ibm.icu.text.CollationKey icuCollKey = fIcuCollator.getCollationKey(source);
return CollationKeyICU.wrap(icuCollKey);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
public CollationKey getResourceNameKey() {
if (resourceNameKey == null) {
resourceNameKey = Collator.getInstance().getCollationKey(
resourceName);
}
return resourceNameKey;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
public CollationKey getDescriptionKey() {
if (descriptionKey == null) {
descriptionKey = Collator.getInstance()
.getCollationKey(description);
}
return descriptionKey;
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.connectivity.sqm.core.ui
public int compare (Object element1, Object element2)
{
if (isValid (element1, element2))
{
String string1 = getName (element1);
String string2 = getName (element2);
return string1 != null && string2 != null ? collator.getCollationKey(string1).compareTo(collator.getCollationKey(string2)) : -1;
}
return -1;
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Get the CollationKey for the string attribute.
*
* @param attribute
* @param defaultValue
* the defaultValue if the value is not set
* @return CollationKey
*/
CollationKey getCollationKey(String attribute, String defaultValue) {
String attributeValue;
Object value = getCache().get(attribute);
if (value != null) {
// Only return a collation key otherwise
//use the value to generate it
if (value instanceof CollationKey) {
return (CollationKey) value;
}
attributeValue = value.toString();
} else {
attributeValue = getAttributeValue(attribute, defaultValue);
}
if (attributeValue.length() == 0) {
return MarkerSupportInternalUtilities.EMPTY_COLLATION_KEY;
}
CollationKey key = Collator.getInstance().getCollationKey(attributeValue);
getCache().put(attribute, key);
return key;
}
内容来源于网络,如有侵权,请联系作者删除!