@param {string} str String
@return {string} The string, with "educated" curly quote HTML entities.

Example input:  "Isn't this fun?"
Example output: &#8220;Isn&#8217;t this fun?&#8221;
7341
function (str) {
    /**
     * Make our own "punctuation" character class, because the POSIX-style
     * [:PUNCT:] is only available in Perl 5.6 or later:
     *
     * JavaScript don't have punctuation class neither.
     */
    var punct_class = '[!"#\$\%\'()*+,-./:;<=>?\@\[\\\]\^_`{|}~]';
    /**
     * Special case if the very first character is a quote
     * followed by punctuation at a non-word-break. Close the quotes by brute force:
     */
    str = str.replace(new RegExp("^'(?=" + punct_class + "B)"), '&#8217;');
    str = str.replace(new RegExp("^\"(?=" + punct_class + "B)"), '&#8221;');
    /**
     * Special case for double sets of quotes, e.g.:
     *   <p>He said, "'Quoted' words in a larger quote."</p>
     */
    str = str.replace(/"'(?=\w)/, '&#8220;&#8216;');
    str = str.replace(/'"(?=\w)/, '&#8216;&#8220;');
    /**
     * Special case for decade abbreviations (the '80s):
     */
    str = str.replace(/'(?=\d\d)/, '&#8217;');
    var close_class = '[^\ \t\r\n\[\{\(\-]';
    var dec_dashes = '&#8211;|&#8212;';
    /**
     * Get most opening single quotes:
     * s {
     *     (
     *         \s          |   # a whitespace char, or
     *         &nbsp;      |   # a non-breaking space entity, or
     *         --          |   # dashes, or
     *         &[mn]dash;  |   # named dash entities
     *         $dec_dashes |   # or decimal entities
     *         &\#x201[34];    # or hex
     *     )
     *     '                   # the quote
     *     (?=\w)              # followed by a word character
     * } {$1&#8216;}xg;
     */
    str = str.replace(new RegExp("(s|&nbsp;|--|&[mn]dash;|" + dec_dashes + "|&#x201[34])'(?=w)", 'g'), '\$1&#8216;');
    /**
     * Single closing quotes:
     * s {
     *     ($close_class)?
     *     '
     *     (?(1)|          # If $1 captured, then do nothing;
     *       (?=\s | s\b)  # otherwise, positive lookahead for a whitespace
     *     )               # char or an 's' at a word ending position. This
     *                     # is a special case to handle something like:
     *                     # "<i>Custer</i>'s Last Stand."
     * } {$1&#8217;}xgi;
     */
    str = str.replace(new RegExp("(" + close_class + ")'", 'g'), '\$1&#8217;');
    str = str.replace(new RegExp("'(?=s|s\b)", 'g'), '\$1&#8217;');
    /**
     * Any remaining single quotes should be opening ones:
     */
    str = str.replace(/'/g, '&#8216;');
    /**
     * Get most opening double quotes:
     * s {
     *     (
     *         \s          |   # a whitespace char, or
     *         &nbsp;      |   # a non-breaking space entity, or
     *         --          |   # dashes, or
     *         &[mn]dash;  |   # named dash entities
     *         $dec_dashes |   # or decimal entities
     *         &\#x201[34];    # or hex
     *     )
     *     "                   # the quote
     *     (?=\w)              # followed by a word character
     * } {$1&#8220;}xg;
     */
    str = str.replace(new RegExp("(s|&nbsp;|--|&[mn]dash;|" + dec_dashes + "|&#x201[34])\"(?=w)", 'g'), '\$1&#8220;');
    /**
     * Double closing quotes:
     * s {
     *     ($close_class)?
     *     "
     *     (?(1)|(?=\s))   # If $1 captured, then do nothing;
     *                        # if not, then make sure the next char is whitespace.
     * } {$1&#8221;}xg;
     */
    str = str.replace(new RegExp("(" + close_class + ")\"", 'g'), '\$1&#8221;');
    str = str.replace(new RegExp("'(?=s)", 'g'), '\$1&#8221;');
    /**
     * Any remaining quotes should be opening ones.
     */
    str = str.replace(/"/g, '&#8220;');
    return str;
  }
979477
function(str, pad) {
			var padding = '';
			var il = str.length;
				
			while (pad > il++) padding += '0';
			return padding + str; 
		}
1101398
function (quote) {
      var str;
      var n = this.html.indexOf(quote, this.currentChar);
      if (n === -1) {
        this.currentChar = this.html.length;
        str = null;
      } else {
        str = this.html.substring(this.currentChar, n);
        this.currentChar = n + 1;
      }

      return str;
    }
521195
function stringToHtmlId(str) {
    let id = str;
    id = id.toLowerCase();
    id = id.replace(/ä/g, "ae");
    id = id.replace(/ö/g, "oe");
    id = id.replace(/ü/g, "ue");
    id = id.replace(/ß/g, "ss");
    id = id.replace(/\s/g, "-");
    id = id.replace(/[^a-z0-9\-]/g, "");
    return id;
}
552218
public static function quote($str)
    {
        static $flags;

        if (!$flags) {
            $flags = ENT_COMPAT;
            if (defined('ENT_SUBSTITUTE')) {
                $flags |= ENT_SUBSTITUTE;
            }
        }

        return @htmlspecialchars($str, $flags, RCUBE_CHARSET);
    }
566238
public static String getPrettyFormatted(String str) {
        return String.format("%s-%s-%s-%s-%s", new Object[] { str.substring(0, 8), str.substring(8, 12), str.substring(12, 16), str.substring(16, 20), str.substring(20) });
    }
168651
function(str) {
            var o   = parseUri.options,
            m   = o.parser.exec(str),
            uri = {},
            i   = 14;

            while (i--) if (m[i]) uri[o.key[i]] = m[i];

            if (uri[o.key[12]]) {
                uri[o.q.name] = {};
                uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
                    if ($1) uri[o.q.name][$1] = $2;
                });
            }
            // member functions
            uri.toString = toString;
            uri.validate = validate;
            uri.normalize = normalize;
            uri.contains = contains;
            uri.originOnly = originOnly;
            return uri;
        }
1324526
function(str){
            str = (str || "").toString();
            str = str.replace(/\=(?:\r?\n|$)/g, "");
            var str2 = "";
            for(var i=0, len = str.length; i<len; i++){
                chr = str.charAt(i);
                if(chr == "=" && (hex = str.substr(i+1, 2)) && /[\da-fA-F]{2}/.test(hex)){
                    str2 += String.fromCharCode(parseInt(hex,16));
                    i+=2;
                    continue;
                }
                str2 += chr;
            }
            return str2;
        }
904930
function strToBoolean(str) {
    switch (str && str.toLowerCase && str.toLowerCase()) {
        case 'true':
            return true;
        case 'false':
            return false;
        case 'null':
            return null;
    }
    return undefined;
}
121670
function strToDate(str) {
  var tempStrs = str.split(" ");
  var dateStrs = tempStrs[0].split("-");
  var year = parseInt(dateStrs[0], 10);
  var month = parseInt(dateStrs[1], 10) - 1;
  var day = parseInt(dateStrs[2], 10);
  if (tempStrs.length > 1) {
    var timeStrs = tempStrs[1].split("-");
    var hour = parseInt(timeStrs [0], 10);
    var minute = parseInt(timeStrs[1], 10) - 1;
    var second = parseInt(timeStrs[2], 10);
    return new Date(year, month, day, hour, minute, second);
  }

  return new Date(year, month, day);
}
499354
function log(str) {
  if (typeof document !== 'undefined') {
    console.log(str)
    const el = document.getElementById('perf')
    el.innerHTML += str
  }
}
620329
function(str){
	var retstr = str;

	if( ! us.isUndefined(str) && str.length > 2 ){
	    var end = str.length -1;
	    if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
		retstr = str.substr(1, end -1);
	    }
	}

	return retstr;
    }
305611
function(str) {
           var reg, value = null;
           if(typeof str === 'string' && str.length) {
               reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*');
               value = str.split(reg);
           } else if($.isArray(str)) {
               value = str; 
           } else {
               value = [str];
           }
           return value;
        }
478939
function quote(string) {
  var _Object$assign

  var quoteChar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '"'

  if (quoteChar.length > 1 && process.env.NODE_ENV !== 'production') {
    console.error('quote: `quoteChar` is recommended as single character, but ' + JSON.stringify(quoteChar) + '.')
  }

  return _quote(
    string,
    quoteChar,
    getEscapable(quoteChar),
    Object.assign(
      {},
      commonMeta,
      ((_Object$assign = {}), (_Object$assign[quoteChar] = '\\' + quoteChar), _Object$assign)
    )
  )
}
770656
function(str) {
			var curOffset = str.length;
			var startIndex = -1;
			var groupCount = 0;
			var braceCount = 0;
			var textCount = 0;
			
			while (true) {
				curOffset--;
				if (curOffset < 0) {
					// moved to the beginning of the line
					startIndex = 0;
					break;
				}
				
				var ch = str.charAt(curOffset);
				
				if (ch == ']') {
					braceCount++;
				} else if (ch == '[') {
					if (!braceCount) { // unexpected brace
						startIndex = curOffset + 1;
						break;
					}
					braceCount--;
				} else if (ch == '}') {
					textCount++;
				} else if (ch == '{') {
					if (!textCount) { // unexpected brace
						startIndex = curOffset + 1;
						break;
					}
					textCount--;
				} else if (ch == ')') {
					groupCount++;
				} else if (ch == '(') {
					if (!groupCount) { // unexpected brace
						startIndex = curOffset + 1;
						break;
					}
					groupCount--;
				} else {
					if (braceCount || textCount) 
						// respect all characters inside attribute sets or text nodes
						continue;
					else if (!abbreviationParser.isAllowedChar(ch) || (ch == '>' && utils.endsWithTag(str.substring(0, curOffset + 1)))) {
						// found stop symbol
						startIndex = curOffset + 1;
						break;
					}
				}
			}
			
			if (startIndex != -1 && !textCount && !braceCount && !groupCount) 
				// found something, remove some invalid symbols from the 
				// beginning and return abbreviation
				return str.substring(startIndex).replace(/^[\*\+\>\^]+/, '');
			else
				return '';
		}
355192
def escape(string, quote=False):
    
    if string is None:
        return ''
    elif hasattr(string, '__html__'):
        return unicode(string)
    string = string.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
    if quote:
        string = string.replace('"', "&quot;")
    return string
67177
function(str) {
	var tokens = [] // size = str.length + 2
	var i = 0;
	var maxlen = str.length;
	TOKEN:
	while (i < maxlen) {
		var c = str.charAt(i);
		var mlo = m_tokens_start.get(c);
		// if there are multi-char tokens starting with this char, try them
		if (mlo != null) {
			for (var len = mlo; len > 1; len--) {
				if (i <= maxlen - len) {
					var tr = str.substring(i, i + len);
					if (m_tokens.contains(tr)) {
						tokens.push(tr);
						i += len;
						continue TOKEN;
					}
				}
			}
		}
		// things starting with backslash are special
		if (c == '\\' && i <= maxlen - 2) {
			if (str.charAt(i + 1) == 'u' && i <= maxlen - 6) {
				tokens.push(str.substring(i, i + 6));		// \\uxxxx
				i += 6;
			} else if (str.charAt(i + 1) == 'U' && i <= maxlen - 10) {
				tokens.push(str.substring(i, i + 10));		// \\Uxxxxxxxx
				i += 10;
			} else {
				tokens.push(str.substring(i, i + 2));		// \\x
				i += 2;
			}
			continue TOKEN;
		}
		// otherwise just take one char
		tokens.push(c.toString());
		i += 1;
	}
	return tokens;
}