Full repo available at https://bitbucket.org/createdbyx/codefarts.utilities-extension-methods-only
/// <summary>
/// Determines weather or not all the characters in a string are all the same.
/// </summary>
/// <param name="value">The value to check for.</param>
/// <returns>true is all characters are the same, otherwise false.</returns>
public static bool AllTheSame(this string value)
{
#if UNITY3D
if (!StringExtensionMethods.IsNullOrWhiteSpace(value))
#else
if (!string.IsNullOrWhiteSpace(value))
#endif
{
var clone = new string(value[0], value.Length);
return clone == value;
}
return false;
}
#if UNITY3D
public static bool IsNullOrWhiteSpace(this string value)
{
if (value == null)
{
return true;
}
for (var i = 0; i < value.Length; i++)
{
if (!char.IsWhiteSpace(value[i]))
{
return false;
}
}
return true;
}
#endif
}