Java - Write code to Wrap given string token with single quotes.

Requirements

Write code to Wrap given string token with single quotes.

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(singleQuote(str));
    }/*from  w w w. j ava  2 s.c  o m*/

    /**
     * Wrap given string token with single quotes.
     * 
     * @param str
     * @return a string token wrapped around with duble quotes
     */
    public static String singleQuote(String str) {
        return ((str == null) ? null : "'" + str + "'");
    }
}