Sort on a string that may contain a number

前端 未结 23 2299
走了就别回头了
走了就别回头了 2020-11-22 02:59

I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the strin

23条回答
  •  野的像风
    2020-11-22 03:42

    In your given example, the numbers you want to compare have spaces around them while the other numbers do not, so why would a regular expression not work?

    bbb 12 ccc

    vs.

    eee 12 ffffd jpeg2000 eee

提交回复
热议问题