Empty string: Difference between revisions
Content added Content deleted
m (Fix format.) |
(+Java) |
||
Line 10: | Line 10: | ||
[[Category:String manipulation]] |
[[Category:String manipulation]] |
||
=={{header|Java}}== |
|||
<code>String.isEmpty()</code> is part of Java 1.6. Other options for previous versions are noted. |
|||
<lang java5>String s = ""; |
|||
if(s != null && s.isEmpty()){//optionally, instead of "s.isEmpty()": "s.length() == 0" or "s.equals("")" |
|||
System.out.println("s is empty"); |
|||
}else{ |
|||
System.out.println("s is not empty"); |
|||
}</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |
||
<lang python>s = '' |
<lang python>s = '' |