我正在构建一个应用程序,并使用webrtc在该应用程序中进行视频聊天,我已经集成了它,但是我在后台遇到了以下崩溃
public static void main(String[] args) throws IOException {
String target = "IWANTTHIS";
//Four possible inputs
String strLineText = "random string with IWANTTHISABC-123 and more"; //works
String strLineText = "IWANTTHISCBC-45601 and more"; //works
String strLineText = "IWANTTHISEBC-1"; //doesn't work
String strLineText = "random string with IWANTTHISKBC-55545"; //doesn't work
//Method1
System.out.println("O/P 1:" + strLineText.substring(strLineText.indexOf(target),
strLineText.indexOf(target) + strLineText.substring(strLineText.indexOf(target)).indexOf(" ") + 1).trim());
//Method2
for (String s : strLineText.split(" "))
if (s.contains(target))
System.out.println("O/P 2:" + s.trim());
}
任何人都可以帮忙吗?