Returns a sanitized string.
494911
def _normalize(self, string):
		'''  '''

		string = super(VerbixFr, self)._normalize(string)
		string = string.replace('il; elle', 'il/elle')
		string = string.replace('ils; elles', 'ils/elles')
		string = string.strip()
		return string
293302
public function sanitizeString($string)
    {
        $string = str_replace('_', '-', GeneralUtility::camelCaseToLowerCaseUnderscored($string));

        while (strpos($string, '--')) {
            $string = str_replace('--', '-', $string);
        }

        return $string;
    }
1258844
public function sanitize($string, $max_length = 0, $allowed = '')
    {
        $text = trim(strip_tags($string, $allowed));
        if ($max_length > 0) {
            if (function_exists('mb_substr')) {
                $text = mb_substr($text, 0, $max_length, APP_CHARSET);
            } else {
                $text = substr($text, 0, $max_length);
            }
        }
        if ($text == null) {
            return ""; // we need to explicitly return a string otherwise some DB functions might insert this as a ZERO.
        }

        return $text;
    }
1173008
def sanitize_mount(mount):
    """"""
    sanitized_mount = mount
    if sanitized_mount.startswith('/'):
        sanitized_mount = sanitized_mount[1:]

    if sanitized_mount.endswith('/'):
        sanitized_mount = sanitized_mount[:-1]

    sanitized_mount = sanitized_mount.replace('//', '/')
    return sanitized_mount
42186
def sanitize_latex(string):
    
    sanitized_string = string
    for old, new in _latex_replacements:
        sanitized_string = sanitized_string.replace(old, new)
    return sanitized_string
155226
public static String sanitize(final String input)
    {
        if ( input == null )
        {
            return "";
        }

        String s = "";

        for ( int i = 0; i < input.length(); i++ )
        {

            char c = input.charAt(i);

            if ( c == '*' )
            {
                // escape asterisk
                s += "\\2a";
            }
            else if ( c == '(' )
            {
                // escape left parenthesis
                s += "\\28";
            }
            else if ( c == ')' )
            {
                // escape right parenthesis
                s += "\\29";
            }
            else if ( c == '\\' )
            {
                // escape backslash
                s += "\\5c";
            }
            else if ( c == '\u0000' )
            {
                // escape NULL char
                s += "\\00";
            }
            else if ( c <= 0x7f )
            {
                // regular 1-byte UTF-8 char
                s += String.valueOf(c);
            }
            else if ( c >= 0x080 )
            {

                // higher-order 2, 3 and 4-byte UTF-8 chars

                try
                {
                    byte[] utf8bytes = String.valueOf(c).getBytes("UTF8");

                    for ( byte b : utf8bytes )
                    {
                        s += String.format("\\%02x", b);
                    }

                }
                catch ( UnsupportedEncodingException e )
                {
                    // ignore
                }
            }
        }

        return s;
    }
76304
static String sanitize(String string) {
        return WHITESPACE.matcher(string.trim()).replaceAll(DASH);
    }
1185746
def safe_str(u, errors="replace"):
    
    s = u.encode(sys.stdout.encoding or "utf-8", errors)
    return s
527904
def sanitize_type(raw_type):
    """"""
    cleaned = get_printable(raw_type).strip()
    for bad in [
            r'__drv_aliasesMem', r'__drv_freesMem',
            r'__drv_strictTypeMatch\(\w+\)',
            r'__out_data_source\(\w+\)',
            r'_In_NLS_string_\(\w+\)',
            r'_Frees_ptr_', r'_Frees_ptr_opt_', r'opt_',
            r'\(Mem\) '
    ]:
        cleaned = re.sub(bad, '', cleaned).strip()
    if cleaned in ['_EXCEPTION_RECORD *', '_EXCEPTION_POINTERS *']:
        cleaned = cleaned.strip('_')
    cleaned = cleaned.replace('[]', '*')
    return cleaned
1272724
private static String sanitizeName(String name) {
        StringBuilder ret = new StringBuilder();
        int underscores = 0;
        boolean lastWasADot = false;
        for (char c : name.toCharArray()) {
            if (c == '_') {
                underscores++;
                // Only _ in a row are allowed
                if (underscores <= 2) {
                    ret.append(c);
                }
                continue;
            }

            if (c == '.') {
                // Only one dot in a row is allowed
                if (!lastWasADot) {
                    ret.append(c);
                }
                lastWasADot = true;
                continue;
            }

            underscores = 0;
            lastWasADot = false;
            if (Character.isLetter(c) || Character.isDigit(c) || c == '-') {
                ret.append(c);
            }
        }

        // All characters must be lowercase
        return ret.toString().toLowerCase();
    }
907722
function sanitize(str, len) {
    len = len || 256;
    if (!str || typeof str === 'string' && str.length < 1)
        return str;
    if (typeof str !== 'string' || str.length > len)
        return null;
    return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
        switch (char) {
            case "\0":
                return "\\0";
            case "\x08":
                return "\\b";
            case "\x09":
                return "\\t";
            case "\x1a":
                return "\\z";
            case "\n":
                return "\\n";
            case "\r":
                return "\\r";
            case "\"":
            case "'":
            case "\\":
            case "%":
                return "\\" + char; // prepends a backslash to backslash, percent,
            // and double/single quotes
        }
    });
}
1238456
private String sanitizePrincipal(final String input) {
        String s = "";

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

            if (c == '*') {
                // escape asterisk
                s += "\\2a";
            } else if (c == '(') {
                // escape left parenthesis
                s += "\\28";
            } else if (c == ')') {
                // escape right parenthesis
                s += "\\29";
            } else if (c == '\\') {
                // escape backslash
                s += "\\5c";
            } else if (c == '\u0000') {
                // escape NULL char
                s += "\\00";
            } else if (c <= 0x7f) {
                // regular 1-byte UTF-8 char
                s += String.valueOf(c);
            } else if (c >= 0x080) {
                // higher-order 2, 3 and 4-byte UTF-8 chars
                byte[] utf8bytes = String.valueOf(c).getBytes(StandardCharsets.UTF_8);

                for (byte b : utf8bytes) {
                    s += String.format(Locale.ENGLISH, "\\%02x", b);
                }
            }
        }

        return s;
    }
1065176
public static function sanitizeString($string)
    {
        if (!$string) {
            return null;
        }

        // Remove linebreaks and HTML tags
        $string = str_ireplace(["\r\n", "\n", "\r"], " ", $string);
        $string = html_entity_decode($string, ENT_NOQUOTES, "UTF-8");
        $string = trim(strip_tags($string));

        if (!$string) {
            return null;
        }

        return (string)$string;
    }
972410
public static String sanitizeName(String name) {

        if (name  == null)
            throw new NullPointerException("Parameter name cannot be null");

        name = name.trim();

        if (name.length() == 0)
            throw new IllegalArgumentException("Parameter name cannot be empty");

        StringBuilder ret = new StringBuilder("");

        for (int i = 0; i < name.length(); i++) {
            char ch = name.charAt(i);
            if (Character.isLetter(ch) || Character.isDigit(ch)) {
                ret.append(ch);
            } else {
                ret.append("_");
            }

        }

        return ret.toString();
    }
709667
public static String sanitizeCategory(String category) {
        String res = null;
        if (StringUtils.isNotBlank(category)) {
            res = category.trim().replaceAll("[^" + CATEGORYNAME_CHARS + "]", "");
            if (!res.equals(category)) LOG.error("Invalid characters in category {}", category);
        }
        return res;
    }
702335
def sanitize(string):
    
    replace_chars = [
        ['\\', '-'], [':', '-'], ['/', '-'],
        ['?', ''], ['<', ''], ['>', ''],
        ['`', '`'], ['|', '-'], ['*', '`'],
        ['"', '\''], ['.', ''], ['&', 'and']
    ]
    for ch in replace_chars:
        string = string.replace(ch[0], ch[1])
    return string
930936
def _sanitize_params(prefix, suffix, dir):
    """"""
    output_type = _infer_return_type(prefix, suffix, dir)
    if suffix is None:
        suffix = output_type()
    if prefix is None:
        if output_type is str:
            prefix = "tmp"
        else:
            prefix = os.fsencode("tmp")
    if dir is None:
        if output_type is str:
            dir = gettempdir()
        else:
            dir = fs_encode(gettempdir())
    return prefix, suffix, dir, output_type