// NOTE: // Golden data in this test case is locale data dependent and // may need to be changed if the Korean locale collation rules // are changed.
// And, CollationDecomp has been set to 0(NO_DECOMPOSITION) in // LocaleElements_ko.java. // This is very important to consider what is correct behavior in // Korean Collator. Sometimes different from other locales.
/* *TERTIARY(default):s1<s2,SECONDARY:s1<s2,PRIMARY:s1<s2
*/ staticfinal String[][] compData1 = { /* *Datatoverify'<'relationshipinLocaleElements_ja.java
*/
{"\uACE0\uC591\uC774", "\u732B", "Hangul \"Cat\"(0xACE0 0xC591 0xC774) <---> Chinese Kanji \"Cat\"(0x732B)"},
{"\u30FB", "\u2025", "Katakana middle dot(0x30FB) <---> Two dot leader(0x2025)"},
{"\u00B1", "\u2260", "Plus-Minus Sign(0x00B1) <---> Not Equal To(0x2260)"},
{"\u3011", "\u2260", "Right Black Lenticular Bracket(0x3011) <---> Not Equal To(0x2260)"},
{"\u2260", "\u2103", "Not Equal To(0x2260) <---> Degree Celsius(0x2103)"},
{"\u2260", "\u2606", "Not Equal To(0x2260) <---> White Star(0x2606)"},
// Unlike other locales' Collator, compare() returns -1 because of // NO_DECOMPOSITION. /* above "assumption" is no longer true, now we do normalize ("decomposition") forthepatterninkolocale,butexcludethosehangulsyllables,sothe testcasebelowneedtobeexcludedfromtiger/1.5 {"\u003D\u0338","\u2260", "Equal(0x003D)CombiningLongSolidusOverlay(0x0338)<--->NotEqualTo(0x2260)"},
*/
};
/* *TERTIARY(default):s1=s2,SECONDARY:s1=s2,PRIMARY:s1=s2
*/ staticfinal String[][] compData2 = { // Verify a character which has been added since Unicode 2.1.X.
{"\u798F", "\uFA1B", "CJK Unified Ideograph \"FUKU\"(0x798F) <---> CJK Compatibility Ideograph \"FUKU\"(0xFA1B)"},
};
Collator col = Collator.getInstance(Locale.KOREA); int result = 0;
publicstaticvoid main(String[] args) throws Exception { new KoreanTest().run();
}
publicvoid run() { // // Test for TERTIARY(default) //
doCompare(compData1);
doEquals(compData2);
// // Test for SECONDARY //
col.setStrength(Collator.SECONDARY);
doCompare(compData1);
doEquals(compData2);
// // Test for PRIMARY //
col.setStrength(Collator.PRIMARY);
doCompare(compData1);
doEquals(compData2);
if (result !=0) { thrownew RuntimeException("Unexpected results on Korean collation.");
}
}
/* compare() should return -1 for each combination. */ void doCompare(String[][] s) { int value; for (int i=0; i < s.length; i++) { if ((value = col.compare(s[i][0], s[i][1])) > -1) {
result++;
System.err.println("TERTIARY: The first string should be less than the second string: " +
s[i][2] + " compare() returned " + value + ".");
}
}
}
/* equals() should return true for each combination. */ void doEquals(String[][] s) { for (int i=0; i < s.length; i++) { if (!col.equals(s[i][0], s[i][1])) {
result++;
System.err.println("TERTIARY: The first string should be equals to the second string: " +
s[i][2] + " compare() returned " +
col.compare(s[i][0], s[i][1] + "."));
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.