mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Flags attribute * empty statement * Fix Formatting * Fix OrderBy -> ThenBy * use OfType * Replace with asingle call to Count(...) * Replace with a single call to FirstOrDefault * Merge cast with type check * use String.IsNullOrEmpty * use collections count property * use format specifier (results in shorter loc) * use Any() instead of Count() > 0 * revert ThenBy with comment
27 lines
782 B
C#
27 lines
782 B
C#
namespace ACE.Common.Extensions
|
|
{
|
|
public static class StringExtensions
|
|
{
|
|
public static bool StartsWithVowel(this string s)
|
|
{
|
|
if (string.IsNullOrEmpty(s))
|
|
return false;
|
|
|
|
char firstLetter = s.ToLower()[0];
|
|
bool isVowel = "aeiou".IndexOf(firstLetter) >= 0;
|
|
|
|
return isVowel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// For objects that don't have a PropertyString.PluralName
|
|
/// </summary>
|
|
public static string Pluralize(this string name)
|
|
{
|
|
if (name.EndsWith("ch") || name.EndsWith("s") || name.EndsWith("sh") || name.EndsWith("x") || name.EndsWith("z"))
|
|
return name + "es";
|
|
else
|
|
return name + "s";
|
|
}
|
|
}
|
|
}
|