Skip to content

Comparison fails with 00 #4

@PaulWoitaschek

Description

@PaulWoitaschek

First of all thanks for your work.

We use it in MaterialAudiobookPlayer to compare file names. But recently a problem came up.

When a String start with zeros, the ordering gets wrong. I wrote a small unit test to demonstrate it here.

String first = "00 I";
String second = "01 I";
assertTrue(NaturalOrderComparator.naturalCompare(first, second) < 0);

This one fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions