TODO ignore case for windows
164705
public static File relativize(File target, File baseDir) {
        String separator = File.separator;
        try {
            String absTargetPath = target.getAbsolutePath();
            absTargetPath = FilenameUtils.normalizeNoEndSeparator(
                    FilenameUtils.separatorsToSystem(absTargetPath));
            String absBasePath = baseDir.getAbsolutePath();
            absBasePath = FilenameUtils.normalizeNoEndSeparator(
                    FilenameUtils.separatorsToSystem(absBasePath));

            if (filePathEquals(absTargetPath, absBasePath)) {
                throw new IllegalArgumentException("target and base are equal: " + absTargetPath);
            }

            String[] absTargets = absTargetPath.split(Pattern.quote(separator));
            String[] absBases = absBasePath.split(Pattern.quote(separator));

            int minLength = Math.min(absTargets.length, absBases.length);

            int lastCommonRoot = -1;
            for (int i = 0; i < minLength; i++) {
                if (filePathEquals(absTargets[i], absBases[i])) {
                    lastCommonRoot = i;
                } else {
                    break;
                }
            }

            if (lastCommonRoot == -1) {
                // This case can happen on Windows when drive of two file paths differ.
                throw new IllegalArgumentException("no common root");
            }

            String relativePath = "";

            for (int i = lastCommonRoot + 1; i < absBases.length; i++) {
                relativePath = relativePath + ".." + separator;
            }

            for (int i = lastCommonRoot + 1; i < absTargets.length; i++) {
                relativePath = relativePath + absTargets[i];
                if (i != absTargets.length - 1) {
                    relativePath = relativePath + separator;
                }
            }
            return new File(relativePath);
        } catch (Exception e) {
            throw new RuntimeException(String.format(
                    "target: %s; baseDir: %s; separator: %s", target, baseDir, separator), e);
        }
    }
15543
public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
    ComparatorItem tmp = comparatorItem;
    while (tmp != null) {
      tmp.setIgnoreCase(ignoreCase);
      tmp = tmp.getNextComparatorItem();
    }
  }
1371758
private boolean skipCommaSpaces2() throws IOException {
        wsp1: for (;;) {
            switch (current) {
                default:
                    break wsp1;
                case 0x20:
                case 0x9:
                case 0xD:
                case 0xA:
                    break;
            }
            current = reader.read();
            appendToContext(current);
        }

        if (current != ',')
            return false; // no comma.

        wsp2: for (;;) {
            switch (current = reader.read()) {
                default:
                    appendToContext(current);
                    break wsp2;
                case 0x20:
                case 0x9:
                case 0xD:
                case 0xA:
                    appendToContext(current);
                    break;
            }
        }
        return true; // had comma
    }
865823
public static String escapeWindowsShell(final String s) {
        if (null == s) {
            return s;
        }
        if (s.startsWith("'") && s.endsWith("'")) {
            return s;
        } else if (s.startsWith("\"") && s.endsWith("\"")) {
            return s.replaceAll("([`^])", "^$1");
        }
        return s.replaceAll("([&><|;^`])", "^$1");
    }
1369994
function ignore(fileMeta, opts) {
    if (typeof opts.ignore === 'function') {
        return opts.ignore(fileMeta, opts);
    }

    if (typeof opts.ignore === 'string' || Array.isArray(opts.ignore)) {
        return micromatch.any(fileMeta.sourceValue, opts.ignore);
    }

    return false;
}
942053
function stringCase(str, caseValue) {
		switch (String(caseValue || '').toLowerCase()) {
			case 'lower':
				return str.toLowerCase();
			case 'upper':
				return str.toUpperCase();
		}
		
		return str;
	}
793997
def ContainsIgnoreCase(self, value):
    
    self._awql = self._CreateSingleValueCondition(value, 'CONTAINS_IGNORE_CASE')
    return self._query_builder
985835
function checkForMissingFilesAndFixFilenameCase() {
  // Get filenames from toc.yaml.
  const filenames = tocText
    .split('\n')
    .filter(line => line.includes('path:'))
    .map(line => line.split(devsitePath)[1]);
  // Logs warning to console if a file from TOC is not found.
  const fileCheckPromises = filenames.map(filename => {
    // Warns if file does not exist, fixes filename case if it does.
    // Preferred filename for devsite should be capitalized and taken from
    // toc.yaml.
    const tocFilePath = `${docPath}/${filename}.html`;
    // Generated filename from Typedoc will be lowercase.
    const generatedFilePath = `${docPath}/${filename.toLowerCase()}.html`;
    return fs.exists(generatedFilePath).then(exists => {
      if (exists) {
        // Store in a lookup table for link fixing.
        lowerToUpperLookup[
          `${filename.toLowerCase()}.html`
        ] = `${filename}.html`;
        return fs.rename(generatedFilePath, tocFilePath);
      } else {
        console.warn(
          `Missing file: ${filename}.html requested ` +
            `in toc.yaml but not found in ${docPath}`
        );
      }
    });
  });
  return Promise.all(fileCheckPromises).then(() => filenames);
}
658997
String convertCase(String str) {
        if (str == null) {
            return null;
        }
        return sensitive ? str : str.toLowerCase();
    }
1159908
def check_case_sensitivity (self):
        
        if os.name != 'nt':
            return
        path = self.get_os_filename()
        realpath = get_nt_filename(path)
        if path != realpath:
            self.add_warning(_("The URL path %(path)r is not the same as the "
                            "system path %(realpath)r. You should always use "
                            "the system path in URLs.") % \
                            {"path": path, "realpath": realpath},
                               tag=WARN_FILE_SYSTEM_PATH)
660352
private boolean handleCaseSensitivityCheck(String path, boolean checkWEBINF) throws IOException {
        if (System.getSecurityManager() != null) {
            final String tmpPath = path;
            final boolean tmpCheckWEBINF = checkWEBINF; //PK81387
            try {
                return ((Boolean) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws IOException {
                        return _handleCaseSensitivityCheck(tmpPath, tmpCheckWEBINF); //PK81387 added tmpCheckWEBINF param
                    }
                })).booleanValue();
            } catch (PrivilegedActionException pae) {
                throw (IOException) pae.getException();
            }
        } else {
            return (_handleCaseSensitivityCheck(path, checkWEBINF)).booleanValue(); //PK81387 added checkWEBINF param
        }
    }
818510
function resolveWindowsExe(cmd) {
    var winExtensions = ['.exe', '.bat', '.cmd', '.js', '.vbs'];
    function isValidExe(c) {
        return winExtensions.indexOf(path.extname(c)) !== -1 && fs.existsSync(c);
    }
    if (isValidExe(cmd)) {
        return cmd;
    }
    cmd = shell.which(cmd) || cmd;
    if (!isValidExe(cmd)) {
        winExtensions.some(function(ext) {
            if (fs.existsSync(cmd + ext)) {
                cmd = cmd + ext;
                return true;
            }
        });
    }
    return cmd;
}
875337
public String getIgnoreCase(String key) {
        int i = indexOfKeyIgnoreCase(key);
        return i == NotFound ? EmptyString : checkNotNull(vals[i]);
    }
229364
function toSpaceCase (string) {
  return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
    return match ? ' ' + match : '';
  });
}
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;
    }
654963
def cleanupFilename(self, name):
        """"""

        context = self.context
        id = ''
        name = name.replace('\\', '/')  # Fixup Windows filenames
        name = name.split('/')[-1]  # Throw away any path part.
        for c in name:
            if c.isalnum() or c in '._':
                id += c

        # Raise condition here, but not a lot we can do about that
        if context.check_id(id) is None and getattr(context, id, None) is None:
            return id

        # Now make the id unique
        count = 1
        while 1:
            if count == 1:
                sc = ''
            else:
                sc = str(count)
            newid = "copy{0:s}_of_{1:s}".format(sc, id)
            if context.check_id(newid) is None \
                    and getattr(context, newid, None) is None:
                return newid
            count += 1
392895
function titleCase(str) {
  return str
    .toLowerCase()
    .replace(/(-|_)/g, ' ')
    .replace(/\w\S*/g, word => word.charAt(0).toUpperCase() + word.substr(1));
}