Sonarr/NzbDrone.Common/StringExtension.cs

25 lines
585 B
C#
Raw Normal View History

using System;
using System.Linq;
namespace NzbDrone.Common
2012-02-16 06:16:57 +00:00
{
2013-04-30 00:04:14 +00:00
public static class StringExtension
2012-02-16 06:16:57 +00:00
{
public static object NullSafe(this object target)
2012-02-16 06:16:57 +00:00
{
if (target != null) return target;
return "[NULL]";
}
public static string NullSafe(this string target)
2012-02-16 06:16:57 +00:00
{
return ((object)target).NullSafe().ToString();
2012-02-16 06:16:57 +00:00
}
public static string FirstCharToUpper(this string input)
{
return input.First().ToString().ToUpper() + String.Join("", input.Skip(1));
}
2012-02-16 06:16:57 +00:00
}
}