SevenDigital.Kata.Euler.Problems.Problem_004_Palindromic.Palindrome.IsPalindrome C# (CSharp) Method

IsPalindrome() public method

public IsPalindrome ( string input ) : bool
input string
return bool
		public bool IsPalindrome(string input)
		{
			for (int i = 0, j = input.Length - 1; i < input.Length && j >= 0; i++, j--)
			{
				if (input[i] != input[j])
					return false;
			}

			return true;
		}
	}

Usage Example

		public void MOAR_PERFORMANCE()
		{
			long loopTicks;
			var first = new Palindrome(9999);

			loopTicks = Time(() => first.IsPalindrome("906609"), 9999);
		//	reverseTicks = Time(() => first.IsPalindromeWithReverse("906609"), 9999);
			

			Console.WriteLine("Loop: {0}", loopTicks);
		//	Console.WriteLine("Loop: {0}", reverseTicks);
			

			Console.WriteLine("Loop: {0}", loopTicks);
		}