escape '&', '<' and '>' characters in txt
499239
def escape(txt)
			@@html_entities.inject(txt.to_s.dup) { |str, map| 
				char, entity = map
				str.gsub!(char, '&' << entity << ';')
				str
			}
		end
784344
def escape(s):
    """"""
    if not isinstance(s, bytes):
        s = s.encode('utf-8')
    return quote(s, safe='~')
175281
private static String escapeXml(String input) {
        return input == null ? "" : input.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
    }
177272
function escapeCommonChars(text) {
  /**
   * Generate new non-escape expression (must happen at execution time because
   * we use `RegExp.exec`, which tracks it's own state internally).
   */
  const nonEscapeExpression = new RegExp(nonEscapePattern, 'gm');

  /**
   * Use `replaceWhen` to escape markdown entities only within substrings that
   * are eligible for escaping.
   */
  return replaceWhen(nonEscapeExpression, escapeAll, text, true);
}
868526
def escape(s)
      s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
        '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase
      }.tr(' ', '+')
    end
956083
function escapeCharacters(params) {
    return params;
    var find = new Array('.','-','%','/','\\\\',':','*','\\','<','>','|','?',' ','&','#');
    var replace = new Array('.0','.1','.2','.3','.4','.5','.6','.7','.8','.9','.a','.b','.c','.d','.e'); 
    var escaped = {};
    for (var param in params) {
        if(typeof(params[param]) == 'string') {
            escaped[param] = replaceCharacter(find, replace, params[param]);
        }
        else {
            escaped[param] = params[param];
        }
    }
    return escaped;
}
493417
func escape(s string) string {
	if strings.IndexAny(s, `'"&<>`) < 0 {
		return s
	}
	var b bytes.Buffer
	for _, r := range s {
		switch r {
		case '"':
			b.WriteString("&quot;")
		case '\'':
			b.WriteString("&apos;")
		case '&':
			b.WriteString("&amp;")
		case '<':
			b.WriteString("&lt;")
		case '>':
			b.WriteString("&gt;")
		default:
			b.WriteRune(r)
		}
	}
	return b.String()
}
264805
def escape(cls, string):
        

        return ''.join([cls._escapes[c] if cls._needescape(c) else c
                        for c in string.encode('utf8')])
131400
def _str_replace(txt):
        """"""
        txt = txt.replace(",", "")
        txt = txt.replace(" ", "_")
        txt = txt.replace(":", "")
        txt = txt.replace(".", "")
        txt = txt.replace("/", "")
        txt = txt.replace("", "")
        return txt
892346
def remove_escapes(self):
        
        chars = []

        i = 0
        while i < len(self.string):
            char = self.string[i]
            if char == "\\":
                i += 1
            else:
                chars.append(char)

            i += 1

        return "".join(chars)
898944
function escape_data(&$value){
    // quick fix for ' character
    /** @todo have a proper function escaping all these */
    if(is_string($value)){
        $value = htmlspecialchars_decode($value);
        $value = self::strip_html_tags($value);
        $value = htmlentities($value);
        $value = stripslashes($value);
        $value = preg_replace('/\'/','´', $value);
        $value = addslashes($value);
        pr($value);
    }
  }
137836
def _escape_markdown_literals(string):
    
    literals = list("\\`*_{}[]()<>#+-.!:|")
    escape = lambda c: '\\' + c if c in literals else c
    return "".join(map(escape, string))
222992
private static String escape(String input) {
        StringBuilder resultStr = new StringBuilder();
        for (char ch : input.toCharArray()) {
            if (isUnsafe(ch)) {
                resultStr.append('%');
                resultStr.append(toHex(ch / 16));
                resultStr.append(toHex(ch % 16));
            } else {
                resultStr.append(ch);
            }
        }
        return resultStr.toString();
    }
743959
public static String escapeXmlString(String str, boolean escapeQuots)
    {
        if (str == null) {
            return "";
        }
        StringBuffer buf = new StringBuffer();
        char[] array = str.toCharArray();
        for (int i = 0; i < array.length; i++) {
            if (array[i] == '>'
                || array[i] == '&'
                || array[i] == '<'
                || (escapeQuots && (array[i] == '\'' || array[i] == '"')))
            {
                buf.append("&#x" + Integer.toHexString(array[i]) + ";");
            } else {
                buf.append(array[i]);
            }
        }
        return buf.toString();
    }
535159
def tex_escape(text):
    
    conv = {
        '&': r'\&',
        '%': r'\%',
        '$': r'\$',
        '#': r'\#',
        '_': r'\_',
        '{': r'\{',
        '}': r'\}',
        '~': r'\textasciitilde{}',
        '^': r'\^{}',
        '\\': r'\textbackslash{}',
        '<': r'\textless ',
        '>': r'\textgreater ',
    }
    regex = re.compile(
        '|'.join(
            re.escape(six.text_type(key))
            for key in sorted(conv.keys(), key=lambda item: -len(item))
        )
    )
    return regex.sub(lambda match: conv[match.group()], text)
87591
def _escape_query(self, query, escaped=False):
        
        if escaped:
            return query
        query = six.text_type(query)
        for e in ['+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*',
                  '?', ':', ' ']:
            query = query.replace(e, "\\%s" % e)
        return query
300083
def _xml_escape(data):
    """"""

    # ampersand must be replaced first
    from_symbols = '&><"\''
    to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
    for from_,to_ in zip(from_symbols, to_symbols):
        data = data.replace(from_, to_)
    return data