Skip to content

Commit d27b8dd

Browse files
committed
updated comparator so symbols are always before letters.
1 parent de78360 commit d27b8dd

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Binary file not shown.
0 Bytes
Binary file not shown.

java_generate/ReferenceGenerator/src/writers/IndexWriter.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ public int compare(String o1, String o2) {
2121
tagEnd = o2.indexOf(">");
2222
String inside2 = o2.substring( tagEnd + 1, tagEnd + 2 );
2323

24+
// check alphanumericity of both strings
25+
if( inside1.matches( "[a-zA-Z0-9 ]+" ) && ! inside2.matches("[a-zA-Z0-9 ]+") )
26+
{
27+
// if only the second is a symbol
28+
return 1;
29+
}
30+
else if( inside2.matches( "[a-zA-Z0-9 ]+" ) && ! inside1.matches("[a-zA-Z0-9 ]+") )
31+
{
32+
// if only the first is a symbol
33+
return 0;
34+
}
35+
36+
// do a normal string comparison on the insides (not the html tags)
2437
return String.CASE_INSENSITIVE_ORDER.compare( inside1, inside2 );
2538
}
2639

0 commit comments

Comments
 (0)