<commit_before>package org.lodder.subtools.sublibrary.util;

public class StringUtils {

	public static String[] join(String[]... arrays) {
		// calculate size of target array
		int size = 0;
		for (String[] array : arrays) {
			size += array.length;
		}

		// create list of appropriate size
		java.util.List<String> list = new java.util.ArrayList<String>(size);

		// add arrays
		for (String[] array : arrays) {
			list.addAll(java.util.Arrays.asList(array));
		}

		// create and return final array
		return list.toArray(new String[size]);
	}

	public static String removeIllegalFilenameChars(String s) {
		s = s.replace("/", "");
		s = s.replace("\0", "");
		return s;
	}

	public static String removeIllegalWindowsChars(String text) {
	    text = text.replace("|", "");
	    text = text.replace("\"", "");
	    text = text.replace("<", "");
	    text = text.replace(">", "");
	    text = text.replace("?", "");
	    text = text.replace("*", "");
	    text = text.replace(":", "");
	    text = text.replace("/", "");
	    text = text.replace("\\", "");
	    if (text.substring(text.length() - 1).equals(".")) {
	      text = text.substring(0, text.length() - 1);
	    }
	    return text.trim();
	  }
}<commit_msg>Fix "String index out of range: -1" and issue #3<commit_after>package org.lodder.subtools.sublibrary.util;

public class StringUtils {

	public static String[] join(String[]... arrays) {
		// calculate size of target array
		int size = 0;
		for (String[] array : arrays) {
			size += array.length;
		}

		// create list of appropriate size
		java.util.List<String> list = new java.util.ArrayList<String>(size);

		// add arrays
		for (String[] array : arrays) {
			list.addAll(java.util.Arrays.asList(array));
		}

		// create and return final array
		return list.toArray(new String[size]);
	}

	public static String removeIllegalFilenameChars(String s) {
		s = s.replace("/", "");
		s = s.replace("\0", "");
		return s;
	}

	public static String removeIllegalWindowsChars(String text) {
	    text = text.replace("|", "");
	    text = text.replace("\"", "");
	    text = text.replace("<", "");
	    text = text.replace(">", "");
	    text = text.replace("?", "");
	    text = text.replace("*", "");
	    text = text.replace(":", "");
	    text = text.replace("/", "");
	    text = text.replace("\\", "");
	    if (text.length() > 0 && text.substring(text.length() - 1).equals(".")) {
	      text = text.substring(0, text.length() - 1);
	    }
	    return text.trim();
	  }
}
{'fraction_non_alphanumeric': 0.1962279293739968, 'fraction_numerical': 0.00521669341894061, 'mean_word_length': 2.9824281150159746, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6274933', 'n_tokens_mistral': 867, 'n_tokens_neox': 804, 'n_words': 193}