1

When declaring dependencies in Gradle I like to keep my dependencies in alphabetical order, however I have come across a situation when I am not sure what the correct order would be. Wikipedia states "Various conventions also exist for the handling of strings containing spaces, modified letters (such as those with diacritics), and non-letter characters such as marks of punctuation", however there is no reference to what these conventions might be.

Specifically I not sure what order I should list the dependencies below.

compile(group: 'commons-pool', name: 'commons-pool', version: '1.2')
compile(group: 'com.google.protobuf', name: 'protobuf-java', version: '2.0.3')

Is there a documented convention for handling lexicographical ordering of punctuation, and where can I find it?

Rylander
  • 19,449
  • 25
  • 93
  • 144
  • I think that you should use a collation http://stackoverflow.com/questions/6810619/how-to-explain-sorting-numerical-lexicographical-and-collation-with-examples – user2485710 Apr 14 '14 at 18:06
  • @user2485710 Is there a particular collation that you can point me to that includes punctuation? – Rylander Apr 14 '14 at 18:27
  • I'm not really familiar with this, but I know that for some reasons, this problems arise quite a few times in `Java` and `MySQL` communities, probably because Java is an old and fully featured language/framework and MySQL or a generic SQL often has to deal with text and ordering algorithms . Try a web search with this terms if no one adds anything new to the discussion. – user2485710 Apr 14 '14 at 18:40

1 Answers1

1

Looking at ASCII values, '.' (ASCII 46) comes before 'm' (ASCII 109). This works for comparing basic punctuation to letters, however you should remember that in ASCII capital 'Z' comes before lowercase 'a'.

UTS #10: Unicode Collation Algorithm covers comparing strings that contain punctuation.

This report is the specification of the Unicode Collation Algorithm (UCA), which details how to compare two Unicode strings while remaining conformant to the requirements of the Unicode Standard. The UCA also supplies the Default Unicode Collation Element Table (DUCET) as the data specifying the default collation order for all Unicode characters.

Rylander
  • 19,449
  • 25
  • 93
  • 144