Java 拆分方法不起作用
我正试着分开一根线,但它不起作用。我调试了我的应用程序,发现问题发生在第8行。第8行显示一个名为pattern.class的文档&应用程序停止工作。我看不出我的代码有任何问题;我刚刚遵守了规则 我如何解决这个问题 我的代码:Java 拆分方法不起作用,java,Java,我正试着分开一根线,但它不起作用。我调试了我的应用程序,发现问题发生在第8行。第8行显示一个名为pattern.class的文档&应用程序停止工作。我看不出我的代码有任何问题;我刚刚遵守了规则 我如何解决这个问题 我的代码: String AdsIds[]=new String[6]; String EnTitle[]=new String[6]; String AdsTemproryData[]=new String[6]; String BineryTemprory[]=new String
String AdsIds[]=new String[6];
String EnTitle[]=new String[6];
String AdsTemproryData[]=new String[6];
String BineryTemprory[]=new String[2];
public void sieve(String Hash){
AdsTemproryData=Hash.split("/");
for(int i=0;i<=5;i++){
BineryTemprory= AdsTemproryData[i].split("*");
AdsIds[i]=BineryTemprory[0];
EnTitle[i]=BineryTemprory[1];
}
您需要避开星号: 分裂\\* 因此,您的代码将是:
String AdsIds[]=new String[6];
String EnTitle[]=new String[6];
String AdsTemproryData[]=new String[6];
String BineryTemprory[]=new String[2];
public void sieve(String Hash){
AdsTemproryData=Hash.split("/");
for(int i=0;i<=5;i++){
BineryTemprory= AdsTemproryData[i].split("\\*");
AdsIds[i]=BineryTemprory[0];
EnTitle[i]=BineryTemprory[1];
}
应用程序抛出哪个异常?将stacktrace添加到您的问题中。你的哈希是什么样子的?为什么问题是大写的?“你在对我大喊大叫吗?”亚历克斯说