正则处理【B站要求秒和毫秒间要求是逗号,而自动生成的为实点.】
public class fsdafsdfe {
public static void main(String[] args) {
String ss = "1\n" +
"00:00:00.320 --> 00:00:06.627\n" +
"我只是想强调一下 Gumayusi\n" +
"对 Ruler 和 369 的出色表现,\n" +
"\n" +
"2\n" +
"00:00:06.627 --> 00:00:16.160\n" +
"他突然跳下并双杀了他们两个。\n" +
"\n" +
"4\n" +
"00:00:16.160 --> 00:00:20.206\n" +
"\n" +
"所以我只是想向你们展示一下,\n" +
"\n" +
"5\n" +
"00:00:20.206 --> 00:00:24.240\n" +
"观察一下他\n" +
"在这么短的时间内移动得有多快\n" +
"\n" +
"6\n" +
"00:00:24.240 --> 00:00:40.408\n" +
"所以我要播放\n" +
"Caedrel 选角的剪辑\n" +
"\n" +
"7\n" +
"00:00:40.408 --> 00:00:43.438\n" +
"绝对疯狂\n" +
"现在屏幕上的这个人\n" +
"\n" +
"8\n" +
"00:00:43.438 --> 00:00:49.494\n" +
"他是 APM, 点击、移动、\n" +
"球体行走机器\n" +
"\n" +
"9\n" +
"00:00:49.494 --> 00:00:54.547\n" +
"现在我要以\n" +
"慢动作再次向大家展示比赛,\n" +
"\n" +
"10\n" +
"00:00:54.547 --> 00:01:01.618\n" +
"我们将快速观察\n" +
"Gumayusi 的行为 好吧,\n" +
"\n" +
"11\n" +
"00:01:01.618 --> 00:01:03.639\n" +
"是的,\n" +
"Keria 就像他说的那样死了\n" +
"\n" +
"12\n" +
"00:01:04.639 --> 00:01:06.665\n" +
"好吧,所以统治者\n" +
"在 Gumayusi 面前闪现,\n" +
"\n" +
"13\n" +
"00:01:06.665 --> 00:01:08.688\n" +
"用他的击中他 第一个问题\n" +
"**实际上是他的自动攻击**\n" +
"\n" +
"14\n" +
"00:01:08.688 --> 00:01:11.714\n" +
"我认为那是嗜血盾牌\n" +
"我不太确定,这是\n" +
"\n" +
"15\n" +
"00:01:11.714 --> 00:01:14.748\n" +
"\n" +
"如果你有最大生命值\n" +
"\n" +
"16\n" +
"00:01:14.748 --> 00:01:18.782\n" +
"并且你获得了多余的盾牌,那么它是你获得的生命偷取(鞋面)\n" +
"盾牌之一标尺击中了他 这样\n" +
"\n" +
"17\n" +
"00:01:18.782 --> 00:01:21.817\n" +
"完全拿出了他的盾牌,\n" +
"甚至还多了100 HP,\n" +
"\n" +
"18\n" +
"00:01:21.817 --> 00:01:24.847\n" +
"从Gumayusi的HP栏来看,他的生命值\n" +
"是369,\n" +
"\n" +
"19\n" +
"00:01:24.847 --> 00:01:28.881\n" +
"所以Gumayusi所做的\n" +
"就是他立即闪现,\n" +
"\n" +
"20\n" +
"00:01:28.881 --> 00:01:32.920\n" +
"看到那两个人在他身上,他在闪现\n" +
"之前先自动攻击Zeri,\n" +
"\n" +
"21\n" +
"00:01:32.920 --> 00:01:36.965\n" +
"\n" +
"所以他得到了他的第一个\n" +
"\n" +
"22\n" +
"00:01:36.965 --> 00:01:39.997\n" +
"自动 攻击关闭然后闪烁 一旦\n" +
"他闪烁,\n" +
"\n" +
"23\n" +
"00:01:39.997 --> 00:01:42.102\n" +
"他不会立即自动攻击\n" +
"他所做的是\n" +
"\n" +
"24\n" +
"00:01:42.102 --> 00:01:47.107\n" +
"从他的位置侧移\n" +
"这是顶级,所以我假设\n" +
"\n" +
"25\n" +
"00:01:47.107 --> 00:01:50.109\n" +
"Gumayusi 认为统治者会\n" +
"立即对他的闪烁做出反应,\n" +
"\n" +
"26\n" +
"00:01:50.109 --> 00:01:54.114\n" +
"所以 Gumayusi 侧移此\n" +
"作为 一旦他闪现,就躲开了\n" +
"\n" +
"27\n" +
"00:01:54.114 --> 00:01:57.117\n" +
"另一个泽里Q\n" +
"唯一击中他的\n" +
"\n" +
"28\n" +
"00:01:57.117 --> 00:02:00.120\n" +
"是一开始当统治者闪现时的一个泽里Q(AA)\n" +
",\n" +
"\n" +
"29\n" +
"00:02:00.120 --> 00:02:05.125\n" +
"然后是369的戈尔德饮者\n" +
",他仍然有这么多生命值\n" +
"\n" +
"30\n" +
"00:02:05.125 --> 00:02:09.129\n" +
"稍后将显示多少\n" +
"1个Q Ruler\n" +
"\n" +
"31\n" +
"00:02:09.129 --> 00:02:13.133\n" +
"对 Gumayusi 做了,这太疯狂了\n" +
"Gumayusi 应该\n" +
"\n" +
"32\n" +
"00:02:13.133 --> 00:02:18.138\n" +
"在大约 0.5 秒内就死了\n" +
"Guma 躲开了 Q,\n" +
"\n" +
"33\n" +
"00:02:18.138 --> 00:02:23.142\n" +
"同时仍然自动攻击 Ruler\n" +
"现在,369 位于 Ruler 之上\n" +
"\n" +
"34\n" +
"00:02:23.142 --> 00:02:26.146\n" +
"事实上 Guma 仍然\n" +
"能够集中注意力,而 AA Ruler\n" +
"\n" +
"35\n" +
"00:02:26.146 --> 00:02:30.150\n" +
"特别是疯狂\n" +
"Ruler拿了一大块,HP已经一半了,\n" +
"\n" +
"36\n" +
"00:02:30.150 --> 00:02:34.154\n" +
"Guma仍然满了,\n" +
"有两个人在他身上,躲开了\n" +
"\n" +
"37\n" +
"00:02:34.154 --> 00:02:38.158\n" +
"另一个,球再次\n" +
"向左走,躲开了\n" +
"\n" +
"38\n" +
"00:02:38.158 --> 00:02:42.162\n" +
"Ruler的Q,\n" +
"到目前为止唯一击中他的\n" +
"\n" +
"39\n" +
"00:02:42.162 --> 00:02:45.165\n" +
"是Aatrox的Goredrinker,\n" +
"Ruler的第一个Flash Q(AA),\n" +
"\n" +
"40\n" +
"00:02:45.165 --> 00:02:49.169\n" +
"和 来自 Aatrox 的 AA\n" +
"这就是立即击中他的\n" +
"\n" +
"41\n" +
"00:02:49.169 --> 00:02:53.173\n" +
"Q,块统治者\n" +
"基本上死了\n" +
"\n" +
"42\n" +
"00:02:54.173 --> 00:02:57.177\n" +
"现在,它将在这里显示 Zeri 的\n" +
"1 个 Q 和 1 个 AA\n" +
"\n" +
"43\n" +
"00:02:57.177 --> 00:03:02.182\n" +
"对 Gumayusi 的作用 好吧,\n" +
"实际上是两个,\n" +
"\n" +
"44\n" +
"00:03:02.182 --> 00:03:06.186\n" +
"那是 2 个 Q 和 1 个 AA\n" +
"它完成了\n" +
"\n" +
"45\n" +
"00:03:06.186 --> 00:03:10.190\n" +
"Gumayusi 一半以上的生命值\n" +
"Gumayusi 应该在\n" +
"\n" +
"46\n" +
"00:03:10.190 --> 00:03:15.194\n" +
"很久以前就死了,369 和统治者在他身上\n" +
"\n" +
"47\n" +
"00:03:15.194 --> 00:03:19.199\n" +
"事实上 Gumayusi-\n" +
"就像他躲开了 3 (2**) 个 Q 一样,这\n" +
"\n" +
"48\n" +
"00:03:19.199 --> 00:03:26.206\n" +
"会杀死他\n" +
"我不知道是什么 369正在做,\n" +
"\n" +
"49\n" +
"00:03:26.206 --> 00:03:28.208\n" +
"也许他的Q在CD上\n" +
"(它在CD上)\n" +
"\n" +
"50\n" +
"00:03:28.208 --> 00:03:34.214\n" +
"但是,他只被一个亚托克斯Q(AA)击中,\n" +
"他将所有AA击中了统治者,\n" +
"\n" +
"51\n" +
"00:03:34.214 --> 00:03:42.222\n" +
"Q是他,并最终让他\n" +
"一半HP 还活着,从亚托克斯那里得到了另一个 AA\n" +
"\n" +
"52\n" +
"00:03:42.222 --> 00:03:47.227\n" +
"所以 2 个亚托克斯 AA 的 2 个 Zeri Q\n" +
"给他带来了那么多的 HP\n" +
"\n" +
"53\n" +
"00:03:47.227 --> 00:03:51.230\n" +
"而那是在\n" +
"大约 0.5 秒的时间内\n" +
"\n" +
"54\n" +
"00:03:51.230 --> 00:04:03.243\n" +
"因为这一切都\n" +
"接近结束\n" +
"\n" +
"55\n" +
"00:04:03.243 --> 00:04:06.246\n" +
"一半的速度但\n" +
"Caedrel 的话仍然有效\n" +
"\n" +
"56\n" +
"00:04:06.246 --> 00:04:23.262\n" +
"他的 APM 穿过屋顶,\n" +
"就像他移动得如此之快一样被\n" +
"\n" +
"57\n" +
"00:04:23.262 --> 00:04:25.265\n" +
"一击中,躲闪,躲闪,被\n" +
"两击中\n" +
"\n" +
"58\n" +
"00:04:25.265 --> 00:04:37.277\n" +
"好吧,所以他躲开了 2 (3) 个本来\n" +
"会杀死他的 Q,在接近尾声时躲开了\n" +
"\n" +
"59\n" +
"00:04:37.277 --> 00:04:41.280\n" +
"2 (3) 个 Zeri Q\n" +
",\n" +
"\n" +
"60\n" +
"00:04:41.280 --> 00:04:43.283\n" +
"或者 在\n" +
"拯救他们的战斗中,\n" +
"\n" +
"61\n" +
"00:04:43.283 --> 00:04:48.288\n" +
"基本上拯救了这场比赛\n" +
"如果Ruler在那场战斗后还活着,\n" +
"\n" +
"62\n" +
"00:04:48.288 --> 00:04:50.289\n" +
"T1这边谁还活着\n" +
"\n" +
"63\n" +
"00:04:50.289 --> 00:04:54.294\n" +
"(JDG这边)\n" +
"369,Ruler,Knight和Missing\n" +
"\n" +
"64\n" +
"00:04:54.294 --> 00:04:58.297\n" +
"对3\n" +
"那会很糟糕\n" +
"\n" +
"65\n" +
"00:04:58.297 --> 00:05:01.300\n" +
"或者我 不知道,这是 T1,所以他们\n" +
"可能会回来,\n" +
"\n" +
"66\n" +
"00:05:01.300 --> 00:05:01.300\n" +
"但是 Gumayusi 是上帝,T1 会以 3-0 获胜,\n" +
"记住我的话\n";
String reg = "\\d+:\\d+\\d+\\.\\d+";
StringBuilder sb = new StringBuilder(ss);
Matcher matcher = Pattern.compile(reg).matcher(ss);
while (matcher.find()){
int start = matcher.start();
int index = matcher.group().indexOf(".");
sb.replace(start + index, start + index + 1, ",");
}
System.out.println(sb);
}
}