public class Main { // 原始字符串 String rawString = "'[]'|1007651102246_PC--chefgapparoniTTV|'[]'|1008939370770_PC--N3LAS|'[]'|1009614872477_PC--RalitsTwitch|'[]'|1010071713191_PC--Twitch-Dnnnn|'[]'|1007970864045_PC--DSK_788|'[]'|1008053680955_PC--douyin_小白|'[]'|1008795761561_PC--卡莎|'[]'|1008348758076_PC--RC_SangJoon|'[]'|1007870483256_PC--Vcan_backhorizon|'[]'|1007376998248_PC--Varayn|'[]'|1010617823111_PC--E8_Shooby|"; // 拆分字符串以提取每個 UID 和名稱 // 遍歷提取 UID 和名稱 for (int i = 1; i < parts.length; i += 2) { // 檢查是否是有效的 UID 部分 if (parts[i].contains("_")) { try { // 打印結果 } } } } }
Standard input is empty
{"uid":1007651102246,"name":"chefgapparoniTTV"} {"uid":1008939370770,"name":"N3LAS"} {"uid":1009614872477,"name":"RalitsTwitch"} {"uid":1010071713191,"name":"Twitch-Dnnnn"} {"uid":1007970864045,"name":"DSK"} {"uid":1008053680955,"name":"douyin"} {"uid":1008795761561,"name":"卡莎"} {"uid":1008348758076,"name":"RC"} {"uid":1007870483256,"name":"Vcan"} {"uid":1007376998248,"name":"Varayn"} {"uid":1010617823111,"name":"E8"}