Sometimes, directory or file names have numbers in the middle, and there may be more than one

Question:

Sometimes, directory or file names have numbers in the middle, and there may be more than one number, for example, sec3_14.txt or sec10_1.txt. Provide a comparator that can compare such strings in a way that makes sense to humans. Break each string into strings not containing digits and digit groups. Then compare two strings by comparing the first non-digit groups as strings, the first digit groups as integers, and so on.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Concepts Late Objects

ISBN: 9781119186717

3rd Edition

Authors: Cay S. Horstmann

Question Posted: