Created
January 4, 2014 00:34
-
-
Save mikedugan/8249670 to your computer and use it in GitHub Desktop.
not incredibly useful, but a basic method to determine if a string is a palindrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static bool IsPalindrome(string value) | |
| { | |
| int min = 0; | |
| int max = value.Length - 1; | |
| while (true) | |
| { | |
| if (min > max) | |
| { | |
| return true; | |
| } | |
| char a = value[min]; | |
| char b = value[max]; | |
| if (char.ToLower(a) != char.ToLower(b)) | |
| { | |
| return false; | |
| } | |
| min++; | |
| max--; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment