About 50 results
Open links in new tab
  1. Why is there no String.Empty in Java? - Stack Overflow

    I understand that every time I type the string literal "", the same String object is referenced in the string pool. But why doesn't the String API include a public static final String Empty = "";,...

  2. Checking if a string is empty or null in Java - Stack Overflow

    Feb 6, 2013 · StringUtils.isBlank(String str) - Checks if a String is whitespace, empty ("") or null. the latter considers a String which consists of spaces or special characters eg " " empty too.

  3. Difference between null and empty ("") Java String

    A reference to an empty string "" points to an object in the heap - so you can call methods on it. But a reference pointing to null has no object to point in the heap and thus you'll get a NullPointerException.

  4. java - Get empty string when null - Stack Overflow

    Feb 21, 2014 · I want to get string values of my fields (they can be type of long string or any object), if a field is null then it should return empty string, I did this with guava; nullToEmpty(String.valueOf(

  5. java - Difference between null and empty string - Stack Overflow

    May 18, 2013 · When Object variables are initially used in a language like Java, they have absolutely no value at all - not zero, but literally no value - that is null For instance: String s; If you were to use s, it …

  6. Checking empty string in Java - Stack Overflow

    Oct 10, 2012 · I don't know what is wrong with the below code.... I am getting input from a textbox and putting the input in a string. If the textbox is empty it will return a empty string. In the below code ...

  7. java - Best way to verify string is empty or null - Stack Overflow

    25 To detect if a string is null or empty, you can use the following without including any external dependencies on your project and still keeping your code simple/clean:

  8. java - Check whether a String is not Null and not Empty - Stack Overflow

    Aug 30, 2010 · To check if a string is not empty you can check if it is null but this doesn't account for a string with whitespace. You could use str.trim() to trim all the whitespace and then chain .isEmpty() to …

  9. Comparing a string with the empty string (Java) - Stack Overflow

    I wish java had a String.Empty that you could set a string to like in C#. It would make the isEmpty () method make more sense, and make it easier cleaner to make a variable equal the empty string.

  10. java - StringUtils.isBlank () vs String.isEmpty () - Stack Overflow

    May 2, 2014 · 707 StringUtils.isBlank() checks that each character of the string is a whitespace character (or that the string is empty or that it's null). This is totally different than just checking if the …