axiosengine/axios/Engine/Extensions/String.cs
Nathan Adams e31ccc4ed4 + * - Adding IsNullOrWhiteSpace extension for support for Xbox 360
+ * - Upon some testing - developers will need to use #if WINDOWS/#endif tags to make sure they can't use XNACC in WP7/Xbox360
2012-05-28 17:01:03 -05:00

33 lines
994 B
C#

using System.Text.RegularExpressions;
namespace Axios.Engine.Extensions
{
public static class AxiosExtensions_String
{
/// <summary>
/// Get the string slice between the two indexes.
/// Inclusive for start index, exclusive for end index.
/// </summary>
public static string Slice(this string source, int start, int end)
{
if (end < 0) // Keep this for negative end support
{
end = source.Length + end;
}
int len = end - start; // Calculate length
return source.Substring(start, len); // Return Substring of length
}
public static bool IsNullOrWhiteSpace(this string str)
{
if (str == null || str == string.Empty)
return true;
if (Regex.Match(str, "([:blank:])").Success)
return true;
return false;
}
}
}