I had run a mySql query from ant, and had the output in "out.txt". In this file, right after listing the rows in the table, there is:
<-- this line is an empty line 0 ro开发者_运维知识库ws affectedIn Java, i am trying take out.txt and make it more readable. I want to ignore the empty line. I have tried: if (!(myStr.contains("\n") ) but it does not work. I have tried "" and null too.
This line is bothering me because when i add some html tags, it is getting in at the very end, and messing up the way the html table looks.
So your workflow is database->ant->out.txt->Java-> what
? You want to make an empty line more readable? myStr is a String, from the mySql-Query or from reading the file back in? I would first try
(myStr != null)
just to be sure, then
(myStr.isEmpty ())
// or
(myStr.length () == 0)
If you tried "" - was it (myStr == "")
or (myStr.equals (""))
?
精彩评论