CCNet.Build.Common.Extensions.RemoveFromEnd C# (CSharp) Method

RemoveFromEnd() public static method

Removes specified text from the ending of the original string.
public static RemoveFromEnd ( this originalText, string textToRemove ) : string
originalText this
textToRemove string
return string
		public static string RemoveFromEnd(this string originalText, string textToRemove)
		{
			if (!originalText.EndsWith(textToRemove))
				throw new InvalidOperationException(
					String.Format("The original text is expected to end with '{0}', but it doesn't.", textToRemove));

			return originalText.Substring(0, originalText.Length - textToRemove.Length);
		}
	}