Remove any surrounding quotes from a value and unescape any contained
        quotes of that type.
765050
def remove_quotes(self, value):
        
        # beware the empty string
        if not value:
            return value

        if value[0] == value[-1] == '"':
            return value[1:-1].replace('\\"', '"')
        if value[0] == value[-1] == "'":
            return value[1:-1].replace("\\'", "'")
        return value
1062424
function stripQuotes (str) {
  var a = str.charCodeAt(0);
  var b = str.charCodeAt(str.length - 1);
  return a === b && (a === 0x22 || a === 0x27)
    ? str.slice(1, -1)
    : str
}
358756
def unquote(str):
    """"""
    if len(str) > 1:
        if str.startswith('"') and str.endswith('"'):
            return str[1:-1].replace('\\\\', '\\').replace('\\"', '"')
        if str.startswith('<') and str.endswith('>'):
            return str[1:-1]
    return str
483174
def _clean(self, value):
		""""""
		
		value = (str(v) for v in value)
		
		if self.strip:
			value = (v.strip() for v in value)
		
		if not self.empty:
			value = (v for v in value if v)
		
		return value
658401
private static String stripSingleDoubleQuote(String input) {
    if (StringUtils.isEmpty(input)) {
      return input;
    }

    if (input.startsWith(SINGLE_QUOTE_STRING)
        || input.startsWith(DOUBLE_QUOTE_STRING)) {
      input = input.substring(1);
    }

    if (input.endsWith(SINGLE_QUOTE_STRING)
        || input.endsWith(DOUBLE_QUOTE_STRING)) {
      input = input.substring(0, input.length() - 1);
    }

    return input;
  }
829064
def unescape_all(string):
    """"""
    def escape_single(matchobj):
        return _unicode_for_entity_with_name(matchobj.group(1))
    return entities.sub(escape_single, string)
743347
def cleanBlockQuotedText(text, joiner=b' '):
    """"""
    L = filter(truth, map(_lineClean, split(text, '\n')))
    return joiner.join(L)
601893
function unescape (line) {
  var retv = _.replace(line, propEscapeRE, '$1');
  retv = _.replace(line, unicodeEscapeRE, function (m) {
    return String.fromCharCode(parseInt(m, 16));
  });
  if (retv !== line) {
    debug('removed escapes from: %s => %s', line, retv);
  }
  return retv;
}
952371
def sanitize(string, ignore_characters=None):
    
    # only deal with strings
    if string is None:
        return

    ignore_characters = ignore_characters or set()

    # replace some characters with one space
    characters = {'-', ':', '(', ')', '.'} - ignore_characters
    if characters:
        string = re.sub(r'[%s]' % re.escape(''.join(characters)), ' ', string)

    # remove some characters
    characters = {'\''} - ignore_characters
    if characters:
        string = re.sub(r'[%s]' % re.escape(''.join(characters)), '', string)

    # replace multiple spaces with one
    string = re.sub(r'\s+', ' ', string)

    # strip and lower case
    return string.strip().lower()
861179
def _filter_string(value):
        
        if value is None:
            value = ""

        # replace whitespace with space
        value = value.replace("\n", " ")
        value = value.replace("\t", " ")

        # CSV seperator
        value = value.replace("|", " ")

        # remove leading/trailing whitespace
        value = value.strip()

        # hack because MAM doesn't quote sql correctly
        value = value.replace("\\", "")

        # Used for stripping non-ascii characters
        value = ''.join(c for c in value if 31 < ord(c) < 127)

        return value
593335
public static function unescape($mixed, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
    {

        if (is_string($mixed)) {
            $mixed = str_replace('&amp;', '&', $mixed);
            $mixed = str_replace('&#039;', '\'', $mixed);
            $mixed = str_replace('&quot;', '"', $mixed);
            $mixed = str_replace('&lt;', '<', $mixed);
            $mixed = str_replace('&gt;', '>', $mixed);
        } elseif (is_object($mixed) || is_array($mixed)) {
            foreach ($mixed as $k => &$v) {
                if ($v) {
                    if (is_object($mixed)) {
                        $mixed->$k = self::unescape($v);
                    } else {
                        $mixed[$k] = self::unescape($v);
                    }
                }
            }
        }

        return $mixed;
    }
882583
protected static String unescape(String value) {

        value = CmsStringUtil.substitute(value, "\\,", ",");
        value = CmsStringUtil.substitute(value, "\\=", "=");
        value = CmsStringUtil.substitute(value, "\\\\", "\\");

        return value;
    }
41464
public static String unescape(String text) {
        StringBuilder builder = new StringBuilder();
        boolean foundQuote = false;

        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);

            if (i == 0 && c == QUOTE || i == text.length() - 1 && c == QUOTE) {
                continue;
            }

            if (c == QUOTE) {
                if (foundQuote) {
                    builder.append(QUOTE);
                    foundQuote = false;
                } else {
                    foundQuote = true;
                }
            } else {
                foundQuote = false;
                builder.append(c);
            }
        }

        return builder.toString();
    }
163964
def clean_text(value, topic=False):
    
    for x in PROFANITY_REPLACEMENTS:
        value = value.replace(x[0], x[1])

    for bbset in BBCODE_REPLACEMENTS:
        p = re.compile(bbset[0], re.DOTALL)
        value = p.sub(bbset[1], value)

    bleached = bleach.clean(value, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES, strip=True)

    # We want to retain markdown quotes and we'll be running bleach again in format_post.
    bleached = bleached.replace('&gt;', '>').replace('&amp;', '&')
    return bleached
100492
def clean(self, value):
        """"""

        if isinstance(value, six.string_types) and value.lower() == 'false':
            return False

        return bool(value)
491622
public static String unescape(String value) {
        for (int i = 0; i < value.length(); i++) {
            final char c = value.charAt(i);
            if (c < ' ' || c >= '~' || (c == '%' && i + 2 < value.length())) {
                return doUnescape(value.getBytes(StandardCharsets.US_ASCII));
            }
        }
        return value;
    }
357763
def remove_quotes(self, configs):
        
        for key in configs:
            value = configs[key]
            if value[0] == "'" and value[-1] == "'":
                configs[key] = value[1:-1]
        return configs