Java String Quote quote(String entityName)

Here you can find the source of quote(String entityName)

Description

quote

License

Open Source License

Declaration

private static String quote(String entityName) 

Method Source Code

//package com.java2s;

public class Main {
    public static final char SINGLE_QUOTE = '\'';
    public static final char ESCAPE_CHAR = '\\';

    private static String quote(String entityName) {
        StringBuilder sb = new StringBuilder();
        sb.append("'");
        for (int i = 0; i < entityName.length(); i++) {
            char curChar = entityName.charAt(i);
            if (curChar == SINGLE_QUOTE || curChar == ESCAPE_CHAR) {
                sb.append(ESCAPE_CHAR);/*from  www  .  j  ava  2 s. com*/
            } else {
                sb.append(curChar);
            }
        }
        sb.append("'");
        return sb.toString();
    }
}

Related

  1. quote(Object s)
  2. quote(Object value)
  3. quote(String content)
  4. quote(String content, String quoteMark)
  5. quote(String content, String quoteMark)
  6. quote(String filepath)
  7. quote(String inp)
  8. quote(String input)
  9. quote(String input)