Here you can find the source of length(String str)
0
if the String is null
.
Parameter | Description |
---|---|
str | a String or <code>null</code> |
0
if the String is null
.
public static int length(String str)
//package com.java2s; public class Main { /**/*w w w. j av a2s. c o m*/ * Gets a String's length or <code>0</code> if the String is <code>null</code>. * * @param str * a String or <code>null</code> * @return String length or <code>0</code> if the String is <code>null</code>. * @since 2.4 */ public static int length(String str) { return str == null ? 0 : str.length(); } }