Java String Quote quotEncode(String txt)

Here you can find the source of quotEncode(String txt)

Description

quot Encode

License

Apache License

Declaration

public static String quotEncode(String txt) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String quotEncode(String txt) {
        if ((txt == null) || (txt.length() == 0)) {
            return txt;
        }/*from  www .  j  a  va  2s .co m*/
        txt = replace(txt, "&", "&");
        txt = replace(txt, "\"", """);
        return txt;
    }

    public static String replace(String str, String subStr, String reStr) {
        if (str == null) {
            return null;
        }
        if ((subStr == null) || (subStr.equals("")) || (reStr == null)) {
            return str;
        }
        return str.replace(subStr, reStr);
    }
}

Related

  1. quoteMonetDbIdentifier(String ident)
  2. quoteMonetDbValue(String value)
  3. quoteNameIfNecessary(String name)
  4. quoteNcName(String ncName)
  5. quotEncode(String txt)
  6. quoteOutputName(String name)
  7. quoteParameter(String param)
  8. quotePath(String path)
  9. quotePattern(String pattern)