今天是第一天,我曾經甚至看到 ASPX,所以,請多多包涵......ASP問題 - 如何計算字符數?
基本上,我想確定一個字符串是空的。如果它是空的,那麼我不想輸出任何東西,如果不是,那麼我想輸出字符串本身。
<%= o_handler.renderDDesc()%> //This is the string itself... If this is empty, then I want I want nothing to print
我想:
<%if (o_handler.renderDDesc().length() > 0) { %>
<%= o_handler.renderDDesc()%>
<%}%>
但是,似乎並沒有做任何事情。我沒有得到一個錯誤,但它也沒有出現?
是這個經典的ASP?或ASP.NET? – 2010-01-28 19:38:00
如果字符串真的是空的,那麼將它寫入響應流確實不會做任何事情。所以你可以放棄IF條件並寫出來。 – Jason 2010-01-28 19:43:35