change a string into lower case except permission classes and URLs.
976579
private static String marshal(String args) {
        if (args != null) {
            StringBuffer target = new StringBuffer();
            StringBuffer source = new StringBuffer(args);

            // obtain the "permission=<classname>" options
            // the syntax of classname: IDENTIFIER.IDENTIFIER
            // the regular express to match a class name:
            // "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*"
            String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]=";
            String keyStr = "permission=";
            String reg = keyReg +
                "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*";
            Pattern pattern = Pattern.compile(reg);
            Matcher matcher = pattern.matcher(source);
            StringBuffer left = new StringBuffer();
            while (matcher.find()) {
                String matched = matcher.group();
                target.append(matched.replaceFirst(keyReg, keyStr));
                target.append("  ");

                // delete the matched sequence
                matcher.appendReplacement(left, "");
            }
            matcher.appendTail(left);
            source = left;

            // obtain the "codebase=<URL>" options
            // the syntax of URL is too flexible, and here assumes that the
            // URL contains no space, comma(','), and semicolon(';'). That
            // also means those characters also could be used as separator
            // after codebase option.
            // However, the assumption is incorrect in some special situation
            // when the URL contains comma or semicolon
            keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]=";
            keyStr = "codebase=";
            reg = keyReg + "[^, ;]*";
            pattern = Pattern.compile(reg);
            matcher = pattern.matcher(source);
            left = new StringBuffer();
            while (matcher.find()) {
                String matched = matcher.group();
                target.append(matched.replaceFirst(keyReg, keyStr));
                target.append("  ");

                // delete the matched sequence
                matcher.appendReplacement(left, "");
            }
            matcher.appendTail(left);
            source = left;

            // convert the rest to lower-case characters
            target.append(source.toString().toLowerCase(Locale.ENGLISH));

            return target.toString();
        }

        return null;
    }
874837
def alpha_cased(text, lower=False):
    
    text = "".join(filter(
            lambda c: c.isalpha() or c == GENERIC_PROTOCOL_KEY, text))
    return text.lower() if lower else text.upper()
1007904
def _irc_lower(self, in_string):
        """"""
        conv_string = self._translate(in_string)
        if self._lower_trans is not None:
            conv_string = conv_string.translate(self._lower_trans)
        return str.lower(conv_string)
1289614
def clean_restricted_chars(path, restricted_chars=restricted_chars):
    '''
    
    '''
    for character in restricted_chars:
        path = path.replace(character, '_')
    return path
378319
def norm_slash(name):
    """"""

    if isinstance(name, str):
        return name.replace('/', "\\") if not is_case_sensitive() else name
    else:
        return name.replace(b'/', b"\\") if not is_case_sensitive() else name
606197
def slugify(string):
    
    string = re.sub('[^\w .-]', '', string)
    string = string.replace(" ", "-")
    return string
1345452
function dashCase(str) {
        var newStr = '';

        for (var i = 0, len = str.length; i < len; i++) {
            if (str[i] === str[i].toUpperCase()) { newStr += '-'; }
            newStr += str[i].toLowerCase();
        }

        return newStr;
    }
228770
public FastStr toLowerCase(Locale locale) {
        String s = toString();
        return unsafeOf(s.toLowerCase(locale));
    }
942053
function stringCase(str, caseValue) {
		switch (String(caseValue || '').toLowerCase()) {
			case 'lower':
				return str.toLowerCase();
			case 'upper':
				return str.toUpperCase();
		}
		
		return str;
	}
151084
def lowercase_chars(string: any) -> str:
        """"""
        return ''.join([c if c.islower() else '' for c in str(string)])
373556
def slugify(cls, s):
        """"""
        slug = re.sub("[^0-9a-zA-Z-]", "-", s)
        return re.sub("-{2,}", "-", slug).strip('-')
846438
def sanitizeString(name):
    """"""
    newString = name
    # string cleaning, pass 1
    replaceTable = [
        ('^', '^5e'),  # we need to do this one first
        ('"', '^22'),
        ('<', '^3c'),
        ('?', '^3f'),
        ('*', '^2a'),
        ('=', '^3d'),
        ('+', '^2b'),
        ('>', '^3e'),
        ('|', '^7c'),
        (',', '^2c'),
    ]

    #   "   hex 22           <   hex 3c           ?   hex 3f
    #   *   hex 2a           =   hex 3d           ^   hex 5e
    #   +   hex 2b           >   hex 3e           |   hex 7c
    #   ,   hex 2c

    for r in replaceTable:
        newString = newString.replace(r[0], r[1])
    # replace ascii 0-32
    for x in range(0, 33):
        # must add somewhat arbitrary num to avoid conflict at deSanitization
        # conflict example: is ^x1e supposed to be ^x1 (ascii 1) followed by
        # letter 'e' or really ^x1e (ascii 30)
        newString = newString.replace(
            chr(x), hex(x + sanitizerNum).replace('0x', '^'))

    replaceTable2 = [
        ("/", "="),
        (":", "+"),
        (".", ","),
    ]

    # / -> =
    # : -> +
    # . -> ,

    # string cleaning pass 2
    for r in replaceTable2:
        newString = newString.replace(r[0], r[1])
    return newString
988400
private function _toLowerChars ($s)
    {
        $lowerFilter = new \Zend\Filter\StringToLower;
        $lowerFilter->setEncoding('utf-8');
        return $lowerFilter->filter($s);
    }
959491
private StringGrabber replaceCaseTo(int startPos, int endPos, ECase toCase) {

		StringBuilder sbRange = new StringBuilder();

		try {
			for (int i = startPos; i < endPos; i++) {
				sbRange.append(String.valueOf(sb.charAt(i)));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		final String caseConvertedRangeStr;

		if (ECase.LOWER == toCase) {
			caseConvertedRangeStr = sbRange.toString().toLowerCase();
		} else {
			caseConvertedRangeStr = sbRange.toString().toUpperCase();
		}
		try {
			sb.replace(startPos, endPos, caseConvertedRangeStr);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return StringGrabber.this;
	}
489503
def remove_unsafe_chars(text):
    """"""
    if isinstance(text, six.string_types):
        text = UNSAFE_RE.sub('', text)
    return text
1232047
def normal_case(name):
    """"""
    s1 = re.sub(r'(.)([A-Z][a-z]+)', r'\1 \2', name)
    return re.sub(r'([a-z0-9])([A-Z])', r'\1 \2', s1).lower()
823672
def convert(string, sanitize=False):
    
    return r.convert(string, (preprocess if sanitize else False))