Skip to content

Unicode sorting #5

@JackPotte

Description

@JackPotte

Would it be possible to sort some non-English words please?

I can't send any pull request but this should work into LineOperations.java:

import java.text.Collator;
import java.util.Locale;
// line 149
                        Comparator<String> comparator = null;
                        Collator collator = null;
                        if (descending) {
                            if (matchCase) {
                                comparator = REVERSE_STRING_COMPARATOR;
                            } else {
                                comparator = REVERSE_STRING_COMPARATOR_CASE_INSENSITIVE;
                            }
                        } else {
                            if (matchCase) {
                                Locale locale = new Locale("fr_FR");
                                collator = Collator.getInstance(locale);
                            } else {
                                comparator = String.CASE_INSENSITIVE_ORDER;
                            }
                        }

                        if (isRemoveDuplicateLines()) {
                            SortedSet<String> uniqifySet = new TreeSet<String>(matchCase ? null : String.CASE_INSENSITIVE_ORDER);
                            uniqifySet.addAll(Arrays.asList(linesText));
                            linesText = uniqifySet.toArray(new String[0]);
                        }

                        if (comparator == null) {
                            Arrays.sort(linesText, collator);
                        } else {
                            Arrays.sort(linesText, comparator);
                        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions