一个 list 里有如下内容
[
"Chuang.guan.dong.2008.S01E01.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E01.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E01.2160p.mkv",
"Chuang.guan.dong.2008.S01E02.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E02.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E02.2160p.mkv",
"Chuang.guan.dong.2008.S01E03.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E03.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E03.2160p.mkv"
]
如何排序成这样下列这样呢?
[
"Chuang.guan.dong.2008.S01E01.mp4",
"Chuang.guan.dong.2008.S01E02.mp4",
"Chuang.guan.dong.2008.S01E03.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E01.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E02.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E03.1080p.mp4",
"闯关东.Brave.The.Journey.To.Northeast.S01E01.2160p.mkv",
"闯关东.Brave.The.Journey.To.Northeast.S01E02.2160p.mkv",
"闯关东.Brave.The.Journey.To.Northeast.S01E03.2160p.mkv"
]
1
ocean1477 2022-12-30 17:31:33 +08:00
看上去像是个 最长公共前缀的问题。
|
2
AoEiuV020CN 2022-12-30 17:34:47 +08:00
需要知道明确的规律,
比如是否保证每部片子各一集这样排列的, 是否保证分辨率都是.XXXp.这样放在后缀前一节的, 是否保证集数都是 S01Exx 这样排列的, |
3
crazytudou 2022-12-30 17:39:39 +08:00
提供个思路,把字符串先分解为对象再来排是不是容易些
eg: string fullname string firstname string secondname string extname |
4
kop1989smurf 2022-12-30 17:43:38 +08:00
如果真的是一定以.分割,而且能确保意义对其的话,直接按照.分割之后逐级排序不行么?
中文的话,可以转拼音之后排序+检索。(防止“王亡王”这种情况发生) |
5
dabaitu OP 统一谢谢楼上大佬们 大概有点思路了
|