add TrimOrEmpty to avoid NREs

This commit is contained in:
Matthias Mailänder
2014-05-17 13:31:37 +02:00
parent cc64b41246
commit dbb4132b66
2 changed files with 8 additions and 3 deletions

View File

@@ -30,6 +30,11 @@ namespace OpenRA
return string.Format(fmt, args);
}
public static string TrimOrEmpty(this string input)
{
return input != null ? input.Trim() : string.Empty;
}
public static T WithDefault<T>(T def, Func<T> f)
{
try { return f(); }