<commit_before>using System.Linq;

namespace System
{
	public static class StringExtensions
	{
		public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
		{
			if (comparisonType == StringComparison.Ordinal)
			{
				if (trimmed)
				{
					return string.CompareOrdinal(source.Trim(), value.Trim()) == 0;
				}
				return string.CompareOrdinal(source, value) == 0;
			}
			if (trimmed)
			{
				return source.Trim().Equals(value.Trim(), comparisonType);
			}
			return source.Equals(value, comparisonType);
		}

		public static bool Contains(this string source, string toCheck, StringComparison comp)
		{
			return source.IndexOf(toCheck, comp) >= 0;
		}

		public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
		{
			return me.Split(separator.ToCharArray(), options);
		}

		/// <summary>
		/// Removes one leading and trailing occurrence of the specified string
		/// </summary>
		public static string Trim(this string me, string trimString, StringComparison comparisonType)
		{
			return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
		}

		/// <summary>
		/// Removes one leading occurrence of the specified string
		/// </summary>
		public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
		{
			if (me.StartsWith(trimString, comparisonType))
			{
				return me.Substring(trimString.Length);
			}
			return me;
		}

		/// <summary>
		/// Removes one trailing occurrence of the specified string
		/// </summary>
		public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
		{
			if (me.EndsWith(trimString, comparisonType))
			{
				return me.Substring(0, me.Length - trimString.Length);
			}
			return me;
		}

		/// <summary>
		/// Returns true if the string contains leading or trailing whitespace, otherwise returns false.
		/// </summary>
		public static bool IsTrimable(this string me)
		{
			if (me.Length == 0)
			{
				return false;
			}

			return char.IsWhiteSpace(me.First()) || char.IsWhiteSpace(me.Last());
		}
	}
}
<commit_msg>Use index operator instead of linq<commit_after>using System.Linq;

namespace System
{
	public static class StringExtensions
	{
		public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
		{
			if (comparisonType == StringComparison.Ordinal)
			{
				if (trimmed)
				{
					return string.CompareOrdinal(source.Trim(), value.Trim()) == 0;
				}
				return string.CompareOrdinal(source, value) == 0;
			}
			if (trimmed)
			{
				return source.Trim().Equals(value.Trim(), comparisonType);
			}
			return source.Equals(value, comparisonType);
		}

		public static bool Contains(this string source, string toCheck, StringComparison comp)
		{
			return source.IndexOf(toCheck, comp) >= 0;
		}

		public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
		{
			return me.Split(separator.ToCharArray(), options);
		}

		/// <summary>
		/// Removes one leading and trailing occurrence of the specified string
		/// </summary>
		public static string Trim(this string me, string trimString, StringComparison comparisonType)
		{
			return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
		}

		/// <summary>
		/// Removes one leading occurrence of the specified string
		/// </summary>
		public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
		{
			if (me.StartsWith(trimString, comparisonType))
			{
				return me.Substring(trimString.Length);
			}
			return me;
		}

		/// <summary>
		/// Removes one trailing occurrence of the specified string
		/// </summary>
		public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
		{
			if (me.EndsWith(trimString, comparisonType))
			{
				return me.Substring(0, me.Length - trimString.Length);
			}
			return me;
		}

		/// <summary>
		/// Returns true if the string contains leading or trailing whitespace, otherwise returns false.
		/// </summary>
		public static bool IsTrimable(this string me)
		{
			if (me.Length == 0)
			{
				return false;
			}

			return char.IsWhiteSpace(me[0]) || char.IsWhiteSpace(me[^0]);
		}
	}
}

{'fraction_non_alphanumeric': 0.11024524409809763, 'fraction_numerical': 0.0027504011001604402, 'mean_word_length': 3.5269709543568464, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '358775', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1254, 'n_words': 365}