更新时间:2023-12-05 17:45:46
只需在拆分前进行替换.
Just do replace before splitting.
String[] tokens = s.replaceFirst(".*=", "").split("/");
起初这将为您提供一个空元素,因为它将在替换后的第一个正斜杠上进行分割.
This would give you an empty element at first because it would do splitting on the first forward slash after replacing.
或
String[] tokens = s.replaceFirst(".*=/", "").split("/");
但是,如果您删除直到 =
的所有字符以及第一个正斜杠,将为您提供所需的输出.
But if you remove all the chars upto the =
along with the first forward slash will give you the desired output.