Java String Quote quoteIfString(Object... arguments)

Here you can find the source of quoteIfString(Object... arguments)

Description

quote If String

License

Open Source License

Declaration

private static Object[] quoteIfString(Object... arguments) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static Object[] quoteIfString(Object... arguments) {
        Object[] result = new Object[arguments.length];
        for (int i = 0; i < arguments.length; i++) {
            result[i] = quoteIfString(arguments[i]);
        }//from  w w  w .jav  a  2 s.c  o m
        return result;
    }

    private static Object quoteIfString(Object argument) {
        Object result;
        if (argument instanceof String) {
            result = quote((String) argument);
        } else {
            result = argument;
        }
        return result;
    }

    private static String quote(String string) {
        return "\"" + string + "\"";
    }
}

Related

  1. quoteIfNotNull(String str)
  2. quoteIfNotNull(String text)
  3. quoteIfNotNull(StringBuilder sb, String val)
  4. quoteIfString(Object obj)
  5. quoteIfString(Object obj)
  6. quoteImpl(String s, char delim)
  7. quoteIt(String orig)
  8. quoteJava(String s)
  9. quoteJavascriptString(String s)