0

我写代码为

String sourceUrlString="http://some url";
Source source=new Source(new URL(sourceUrlString));
Element INFORM = source.getElementById("main").getAllElementsByClass("game").get(i-1);
String INFORM = INFORM.replaceAll("\\s","");   //shows error here
sendResponse(resp,+INFORM);

现在我想要从 Element 获取的文本INFORM是忽略空白我该怎么做?上面提到的String INFORMShow error Duplicate local variable INFORM );

例如

Element INFORM 获取的文本是“我的名字是 satish”,但它必须发送响应为

“我的名字”

4

1 回答 1

0

你的名字INFORM被使用了两次——那是不可能的!

String sourceUrlString = "http://some url";
Source source = new Source(new URL(sourceUrlString));
Element INFORM = source.getElementById("main").getAllElementsByClass("game").get(i-1);
String response = INFORM.replaceAll("\\s","");   // ! Use another name here !
sendResponse(resp, respone); // or use '+' - not shure if 1 or 2 args
于 2013-03-24T13:18:48.913 回答