| 1 |
# test_StringsIndex.praat |
| 2 |
# djmw 20221010 |
| 3 |
|
| 4 |
appendInfoLine: "test_StringsIndex.praat" |
| 5 |
|
| 6 |
# example from: https://github.com/sourcefrog/natsort/blob/master/example-out.txt |
| 7 |
str = Create Strings from tokens: "example1", "1-2,1-02,1-20,10-20,fred,jane,pic01,pic2,pic02,pic02a,pic3, |
| 8 |
...pic4,pic 4 else,pic 5,pic05,pic 5 ,pic 5 something,pic 6,pic 7,pic100,pic100a,pic120,pic121, |
| 9 |
...pic02000,tom,x2-g8,x2-y7,x2-y08,x8-y8", "," |
| 10 |
|
| 11 |
str$# = List all strings |
| 12 |
strs$# = shuffle$# (str$#) |
| 13 |
stri = To StringsIndex: "number-aware" |
| 14 |
stris= To Strings |
| 15 |
stris$# = List all strings |
| 16 |
for i to size (str$#) |
| 17 |
assert str$# [i] = stris$# [i] |
| 18 |
endfor |
| 19 |
selectObject: str |
| 20 |
p = To Permutation: "number-aware" |
| 21 |
selectObject: str, p |
| 22 |
strp = Permute strings |
| 23 |
strp$# = List all strings |
| 24 |
|
| 25 |
removeObject: stri, stris, p, strp, str |
| 26 |
|
| 27 |
appendInfoLine: "test_StringsIndex.praat OK" |