<commit_before>package com.blazebit.lang;

import java.util.Iterator;

public final class StringUtils {

	private StringUtils(){}
	
	public static boolean isEmpty(CharSequence sequence){
		if(sequence == null || sequence.length() == 0){
			return true;
		}
		
		return false;
	}

	public static boolean isEmpty(CharSequence... sequence){
		if(sequence == null || sequence.length == 0){
			return true;
		}
		
		for(CharSequence s : sequence){
			if(s == null || s.length() == 0){
				return true;
			}
		}
		
		return false;
	}

	public static String join(CharSequence delimiter, CharSequence... parts){
		return join(new StringBuilder((parts.length + delimiter.length()) * 10), delimiter, parts).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, CharSequence... parts){
		if(parts.length == 0){
			return sb;
		}
		
		final int last = parts.length - 1;
		
		for (int i = 0; i < last; i++) {
			sb.append(parts[i]);
			sb.append(delimiter);
		}
		
		sb.append(parts[last]);
		return sb;
	}
	
	public static String join(CharSequence delimiter, Iterable<? extends CharSequence> parts){
		return join(new StringBuilder(), delimiter, parts).toString();
	}
	
	public static <X, Y> String join(CharSequence delimiter, Iterable<X> parts, ValueRetriever<X, Y> expression){
		return join(new StringBuilder(), delimiter, parts, expression).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterable<? extends CharSequence> parts){
		return join(sb, delimiter, parts.iterator());
	}
	
	public static <X, Y> StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterable<X> parts, ValueRetriever<X, Y> expression){
		return join(sb, delimiter, parts.iterator(), expression);
	}
	
	public static String join(CharSequence delimiter, Iterator<? extends CharSequence> iter){
		return join(new StringBuilder(), delimiter, iter).toString();
	}
	
	public static <X, Y> String join(CharSequence delimiter, Iterator<X> iter, ValueRetriever<X, Y> expression){
		return join(new StringBuilder(), delimiter, iter, expression).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterator<? extends CharSequence> iter){
		if(!iter.hasNext()){
			return sb;
		}
		
		sb.append(iter.next());
		
		while (iter.hasNext()) {
			sb.append(delimiter);
			sb.append(iter.next());
		}
		
		return sb;
	}
	
	public static <X, Y> StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterator<X> iter, ValueRetriever<X, Y> expression){
		if(!iter.hasNext()){
			return sb;
		}
		
		sb.append(expression.getValue(iter.next()).toString());
		
		while (iter.hasNext()) {
			sb.append(delimiter);
			sb.append(expression.getValue(iter.next()).toString());
		}
		
		return sb;
	}
	
	public static String firstToUpper(CharSequence s){
		return addFirstToUpper(new StringBuilder(s.length()), s).toString();
	}
	
	public static StringBuilder addFirstToUpper(StringBuilder sb, CharSequence s){
		sb.append(Character.toUpperCase(s.charAt(0)));
		sb.append(s, 1, s.length());
		return sb;
	}
}<commit_msg>Added method for lowering the first char of a string<commit_after>package com.blazebit.lang;

import java.util.Iterator;

public final class StringUtils {

	private StringUtils(){}
	
	public static boolean isEmpty(CharSequence sequence){
		if(sequence == null || sequence.length() == 0){
			return true;
		}
		
		return false;
	}

	public static boolean isEmpty(CharSequence... sequence){
		if(sequence == null || sequence.length == 0){
			return true;
		}
		
		for(CharSequence s : sequence){
			if(s == null || s.length() == 0){
				return true;
			}
		}
		
		return false;
	}

	public static String join(CharSequence delimiter, CharSequence... parts){
		return join(new StringBuilder((parts.length + delimiter.length()) * 10), delimiter, parts).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, CharSequence... parts){
		if(parts.length == 0){
			return sb;
		}
		
		final int last = parts.length - 1;
		
		for (int i = 0; i < last; i++) {
			sb.append(parts[i]);
			sb.append(delimiter);
		}
		
		sb.append(parts[last]);
		return sb;
	}
	
	public static String join(CharSequence delimiter, Iterable<? extends CharSequence> parts){
		return join(new StringBuilder(), delimiter, parts).toString();
	}
	
	public static <X, Y> String join(CharSequence delimiter, Iterable<X> parts, ValueRetriever<X, Y> expression){
		return join(new StringBuilder(), delimiter, parts, expression).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterable<? extends CharSequence> parts){
		return join(sb, delimiter, parts.iterator());
	}
	
	public static <X, Y> StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterable<X> parts, ValueRetriever<X, Y> expression){
		return join(sb, delimiter, parts.iterator(), expression);
	}
	
	public static String join(CharSequence delimiter, Iterator<? extends CharSequence> iter){
		return join(new StringBuilder(), delimiter, iter).toString();
	}
	
	public static <X, Y> String join(CharSequence delimiter, Iterator<X> iter, ValueRetriever<X, Y> expression){
		return join(new StringBuilder(), delimiter, iter, expression).toString();
	}
	
	public static StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterator<? extends CharSequence> iter){
		if(!iter.hasNext()){
			return sb;
		}
		
		sb.append(iter.next());
		
		while (iter.hasNext()) {
			sb.append(delimiter);
			sb.append(iter.next());
		}
		
		return sb;
	}
	
	public static <X, Y> StringBuilder join(StringBuilder sb, CharSequence delimiter, Iterator<X> iter, ValueRetriever<X, Y> expression){
		if(!iter.hasNext()){
			return sb;
		}
		
		sb.append(expression.getValue(iter.next()).toString());
		
		while (iter.hasNext()) {
			sb.append(delimiter);
			sb.append(expression.getValue(iter.next()).toString());
		}
		
		return sb;
	}
	
	public static String firstToUpper(CharSequence s){
		return addFirstToUpper(new StringBuilder(s.length()), s).toString();
	}
	
	public static StringBuilder addFirstToUpper(StringBuilder sb, CharSequence s){
		sb.append(Character.toUpperCase(s.charAt(0)));
		sb.append(s, 1, s.length());
		return sb;
	}
	
	public static String firstToLower(CharSequence s){
		return addFirstToLower(new StringBuilder(s.length()), s).toString();
	}
	
	public static StringBuilder addFirstToLower(StringBuilder sb, CharSequence s){
		sb.append(Character.toLowerCase(s.charAt(0)));
		sb.append(s, 1, s.length());
		return sb;
	}
}
{'fraction_non_alphanumeric': 0.1349946491362177, 'fraction_numerical': 0.0033634000917290934, 'mean_word_length': 4.483654652137469, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, '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': '3109704', 'n_tokens_mistral': 2218, 'n_tokens_neox': 1930, 'n_words': 539}