• Stars
    star
    1
  • Language
    Scala
  • License
    Other
  • Created almost 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

scala naturalsort algorithm

NaturalSort Build Status License Maven Scaladex

Natural (human) sorting algorithm : ["a1", "a3", "a10", "a2", "a21"] will be sorted as ["a1", "a2", "a3", "a10", "a21"] and not ["a1", "a10", "a2", "a21", "a3"]. It merges alphabetical and numeric sorting.

In your build.sbt, add this : libraryDependencies += "fr.janalyse" %% "naturalsort" % version

Usage

Examples coming from the test cases :

  import fr.janalyse.tools.NaturalSort._
  
  test("monkey tests") {
    val t0 = new TreeSet[String]() ++ List("")
    t0.toList should equal (List(""))
    
    val t1 = new TreeSet[String]() ++ List("", "A", "0")
    t1.toList should equal (List("", "0", "A"))
  }
  

  test("basic tests") {
    val t0 = new TreeSet[String]() ++ List("10", "5", "1")
    t0.toList should equal (List("1", "5", "10"))
  
    val t1 = new TreeSet[String]() ++ List("a-100","a-10", "a-5", "a-1")
    t1.toList should equal (List("a-1", "a-5", "a-10", "a-100"))
  }
	
	
  test("advanced tests") {
    val t2 = new TreeSet[String]() ++ List("1.10.1","02.1.2","a100","1.100.2","2.0","","a10","a1","a5","1.9.1")
    t2.toList should equal (List("","1.9.1","1.10.1","1.100.2","2.0","02.1.2","a1","a5","a10","a100"))
		
    val t3 = new TreeSet[String]() ++ List("a20", "a0","a1","a1b","a1a","a10","a","a2")
    t3.toList should equal (List("a", "a0", "a1", "a1a", "a1b", "a2", "a10", "a20"))
		
    val t4 = new TreeSet[String]() ++ List("x2-g8",  "x2-y7" , "x2-y08" , "x8-y8")
    t4.toList should equal (List("x2-g8", "x2-y7", "x2-y08", "x8-y8"))
  }

More Repositories

1

jassh

High level scala SSH API for easy and fast operations on remote servers.
Scala
71
star
2

code-examples-manager

Software tool to manage your notes, scripts, code examples, configs,... to publish them as gists or snippets
Scala
37
star
3

zio-lmdb

Lightning Memory Database (LMDB) for scala ZIO
Scala
36
star
4

jajmx

scala JMX API
Scala
31
star
5

sotohp

Photos management
Scala
27
star
6

scala-drools-dummy-project

Minimalist scala drools project
Scala
19
star
7

coursier-launcher

coursier docker container for efficient application or service download and startup
Makefile
9
star
8

zwords

A wordle game for communities
Scala
8
star
9

jaseries

scala API for time numerical series operations.
Scala
7
star
10

primes

Playing with primes using scala language. Draw Ulam spiral, ...
Scala
7
star
11

zio-worksheet

Simplified ZIO user experience in REPL, worksheet or script contexts
Scala
6
star
12

bootstrap

scala script bootstrap mechanism with #include support
Scala
6
star
13

the-weakest-link

Scala
4
star
14

custom-collection

Custom scala collection examples
Scala
4
star
15

scala-dummy-project

scala dummy project with standalone executable jar
Shell
3
star
16

drools-scripting

Drools made easy to use for scripting or testing purposes
Scala
2
star
17

codingame-with-scalakit-example

codingame scalakit example using git submodule to reference the scalakit
Scala
2
star
18

simple-plugin-architecture

Scala simple plugin architecture (with plugin automatic compilation if required)
Scala
2
star
19

exproxy

a 2005 personal project...
Java
2
star
20

cntlm

dockerized cntlm
Shell
2
star
21

primes-scalatra-app

Scala
1
star
22

web-echo

A websocket/webhook JSON data recorder with API
Scala
1
star
23

akka-sandbox

temporary project to test and learn AKKA 2
Scala
1
star
24

advent-of-code-2023

Scala
1
star
25

bullyboy

sha1 brute force attack
Scala
1
star
26

the-rules-for-good-code-examples

Several rules to write the best possible source code examples
1
star
27

data-recorder

Scala
1
star
28

advent-of-code-2020

Scala
1
star
29

jenkins-phantomjs-slave

jenkins slave with phantomjs 1.9 docker image
1
star
30

dock-primesui

Shell
1
star
31

jenkins

Jenkins docker image
Shell
1
star