Return always a non-null string and strip of leading slash
186321
private static String normalizePathInfo(String pPathInfo) {
        if (pPathInfo != null && pPathInfo.length() > 0) {
            return pPathInfo.startsWith("/") ? pPathInfo.substring(1) : pPathInfo;
        } else {
            return "";
        }
    }
1367815
public static String stripIllegalCharacters(String s)
    {
        char c;
        boolean needsStrip = false;
        StringBuilder sb;

        if (s == null)
        {
            return null;
        }

        for (int i = 0; i < s.length(); i++)
        {
            c = s.charAt(i);
            if (c >= '0' && c <= '9')
            {
                // continue
            } // NOPMD
            else if (c >= 'a' && c <= 'z')
            {
                // continue
            } // NOPMD
            else
            {
                needsStrip = true;
                break;
            }
        }

        if (!needsStrip)
        {
            return s;
        }

        sb = new StringBuilder(s.length());
        for (int i = 0; i < s.length(); i++)
        {
            c = s.charAt(i);
            if (c >= '0' && c <= '9')
            {
                sb.append(c);
            }
            else if (c >= 'a' && c <= 'z')
            {
                sb.append(c);
            }
        }

        return sb.toString();
    }
449299
def null_term(str):
    ''''''
    idx = str.find("\0")
    if idx != -1:
        str = str[:idx]
    return str
189246
function (base, path, noStartingSlash) {

        if (base === path) {
            return '';
        }

        // Sanitize inputs, convert windows to posix style slashes, ensure trailing slash for base
        base = base.replace(/^[a-z]:/i, '').replace(/\\/g, '/').replace(/\/$/g, '') + '/';
        path = path.replace(/^[a-z]:/i, '').replace(/\\/g, '/');
        // console.log(' ==== '+path);
        // Only truncate paths that overap with the base
        if (base === path.substr(0, base.length)) {
            path = '/' + path.substr(base.length);
        }

        var modifyStartingSlash = noStartingSlash !== undefined;

        if(modifyStartingSlash) {
            if (path[0] === '/' && noStartingSlash) {
                path = path.substr(1);
            } else if (path[0] !== '/' && !noStartingSlash){
                path = '/' + path;
            }
        }

        return path;

    }
691281
private String maybeAddTrailingSlash(String key) {
    if (!key.isEmpty() && !key.endsWith("/")) {
      return key + '/';
    } else {
      return key;
    }
  }
168399
private static String trimAtNull(final String s)
	{
		final int end = s.indexOf((char) 0);
		return end > -1 ? s.substring(0, end) : s;
	}
556240
function(str) {
      var type, res;

      str = str || '';
      res = str.match(/(uncaught)?\s?(\w+)\:/i);
      type = (res) ? res[2] : null;

      return type;
    }
886891
def back_slash_to_front_converter(string):
    
    try:
        if not string or not isinstance(string, str):
            return string
        return string.replace('\\', '/')
    except Exception:
        return string
1167904
private static String validString(Object data) throws IOException {
        // Null is ok
        if (data == null) {
            return "";
        }
        if (!(data instanceof String)) {
            throw new IOException("Invalid non-String value found!");
        }
        return (String) data;
    }
698571
function() {
		var str = this.trim();
		str = this.charAt(0).toUpperCase() + this.slice(1);
		if (!str.match(/[?!\.]$/)) str = str+'.';
		return str;
	}
52311
private static String ensureLeadingSlash(@Nullable String uri) {
        if (uri == null)
            return "/";
        return uri.startsWith("/") ? uri : "/" + uri;
    }
1090293
function (path) {
        if (!path) {
            return;
        }
        // TODO Name have slash ?
        var pathArr = path.split('/');
        var current = this;
        for (var i = 0; i < pathArr.length; i++) {
            var name = pathArr[i];
            // Skip empty
            if (!name) {
                continue;
            }
            var found = false;
            var children = current._children;
            for (var j = 0; j < children.length; j++) {
                var child = children[j];
                if (child.name === name) {
                    current = child;
                    found = true;
                    break;
                }
            }
            // Early return if not found
            if (!found) {
                return;
            }
        }

        return current;
    }
610017
def nts(self, s):
        
        # Use the string up to the first null char.
        p = s.find("\0")
        if p == -1:
            return s
        return s[:p]
533576
def safestr(str_):
    '''  '''
    str_ = str_ or ""
    return "".join(x for x in str_ if x.isalnum())
111442
function clean_path(string) {
    var arr = string.split('/');
    var _arr = [];
    for (var elm of arr) {
      if (elm) {
        _arr.push(elm);
      }
    }
    return _arr.join('/');
  }
105702
function () {
                    var name, nameLC, args, alpha_ret, index = i;

                    name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(current);
                    if (!name) { return; }

                    name = name[1];
                    nameLC = name.toLowerCase();
                    if (nameLC === 'url') {
                        return null;
                    }

                    i += name.length;

                    if (nameLC === 'alpha') {
                        alpha_ret = parsers.alpha();
                        if(typeof alpha_ret !== 'undefined') {
                            return alpha_ret;
                        }
                    }

                    $char('('); // Parse the '(' and consume whitespace.

                    args = this.arguments();

                    if (! $char(')')) {
                        return;
                    }

                    if (name) { return new(tree.Call)(name, args, index, env.currentFileInfo); }
                }
196037
function stripParameters(str) {
	// Split parameters or split folder separator
	if (str.indexOf('?') > -1) {
		return str.split('?')[0];
	} else if (str.indexOf('/') > -1) {
		return str.split('/')[0];
	}
	return str;
}