我正在使用 Java,我正在使用 StringTokenizer 来获取我的 String 的一部分,但问题是当我使用“StringTokenizer”时,我的结果的一部分没有出现这是我的 java 代码:
for(String iopp:opp){
StringTokenizer tokenizer = new StringTokenizer(iopp,"form:blocConfigurations:configurations:0:parametrage:options:");
while(tokenizer.hasMoreTokens()){
ind.add(tokenizer.nextToken());
}
}
logger.info("Mes indices sont :"+ind);
在我的控制台中:
what was it :[form:blocConfigurations:configurations:0:parametrage:options:1, form:blocConfigurations:configurations:0:parametrage:options:6, form:blocConfigurations:configurations:0:parametrage:options:9, form:blocConfigurations:configurations:0:parametrage:options:17, form:blocConfigurations:configurations:0:parametrage:options:20, form:blocConfigurations:configurations:0:parametrage:options:21, form:blocConfigurations:configurations:0:parametrage:options:22]
17:13:45,876 INFO [com.sfr.price.functionalTest.scenario.impl.AJLINGE.etapeParametrerOption](821) [] Mes indices sont :[1, 6, 9, 17, 2, 21, 22]
StringToknizer 工作得很好,但我不明白为什么在这个元素形式中:blocConfigurations:configurations:0:parametrage:options:20 它只显示 2 而不是 20
提前致谢