我的视图中有以下输出
//GET RECEIVED MESSAGES
public List<SmsMessage> getSmsMessages() {
List<SmsMessage> result = new ArrayList();
String smsDump = getSmsDump();
String received = "RECEIVED";
String status = "1";
if (null != smsDump) {
Document messageDump = Jsoup.parse("<html><head></head><body><table>" + smsDump + "</table></body></html>");
messageDump.outputSettings(new Document.OutputSettings().prettyPrint(false));
Elements rows = messageDump.getElementsByTag("tr");
String hasRead = "0"; //no
// Lambda expression for iterating row elements
rows.stream().map((Element row) -> {
SmsMessage message = new SmsMessage();
Elements cols = row.getElementsByTag("td");
message.setMessageId(cols.get(0).text()); // Message ID
message.setSender(cols.get(1).text()); // Sender
message.setSmsc(cols.get(2).text()); // SMSC
message.setPortId(cols.get(3).text()); // Port ID
String initial = cols.get(4).wholeText();
byte[] ptext = initial.getBytes(ISO_8859_1);
String newContent = new String(ptext, UTF_8);
message.setContent(newContent);
message.setReceiveTime(cols.get(5).text()); // Receive Time
message.setHasRead(hasRead); // Has Read
message.setTypeOfMessage(received);
message.setMessageStatus(status);
return message;
}).forEachOrdered((message) -> {
result.add(message);
//LOGGER.debug(message.toString());
});
}
return result;
} // end getSmsMessages()
我希望我的Description的输出没有任何显示空白/空格的数字。
protected void poll() {
LOGGER.debug("### GETTING SMS MESSAGES FROM GATEWAY ###");
TG800Connector smsGateway = new TG800Connector(sshHost, sshUser, sshPassword, sshPort);
List<SmsMessage> smsList = smsGateway.getSmsMessages();
List<SmsMessage> smsSendList = smsGateway.getSmsSendMessages();
LOGGER.debug("############### GETING SMS MESSAGES FROM GATEWAY #####################");
try {
smsMapper.insertSmsListTest(smsList);
smsMapper.insertSmsSendList(smsSendList);
LOGGER.debug("############# STORING OF MESSAGES TO DATABASE SUCCESSFULL ################");
}catch(Exception e) {
LOGGER.debug("################ Storing Failed! ######################");
}
}
我将价格声明为小数。我包括检查值='0'是否将“”移至该字段,但由于十进制不能为空/空白,所以它不起作用。有人可以帮忙吗? 预先感谢