Java String Quote quoteIfNotNull(StringBuilder sb, String val)

Here you can find the source of quoteIfNotNull(StringBuilder sb, String val)

Description

quote If Not Null

License

Open Source License

Declaration

static void quoteIfNotNull(StringBuilder sb, String val) 

Method Source Code

//package com.java2s;

public class Main {
    static void quoteIfNotNull(StringBuilder sb, String val) {
        if (val == null)
            sb.append("null");
        else/*w  w  w  .  ja  va2  s.com*/
            sb.append("'").append(val).append("'");
    }

    static String quoteIfNotNull(String val) {
        return (val == null) ? "null" : new StringBuilder("'").append(val)
                .append("'").toString();
    }
}

Related

  1. quoteIfNeeded(String source)
  2. quoteIfNeeded(String value)
  3. quoteIfNeeded(StringBuilder buf, String str, String delim)
  4. quoteIfNotNull(String str)
  5. quoteIfNotNull(String text)
  6. quoteIfString(Object obj)
  7. quoteIfString(Object obj)
  8. quoteIfString(Object... arguments)
  9. quoteImpl(String s, char delim)