Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Tagged as

To check string is palindrome or not in .NET (C#)

, 6 Feb 2011
Rate this:
Please Sign up or sign in to vote.
How about:public bool IsPalindrome(string stringToCheck){ char[] rev = stringToCheck.Reverse().ToArray(); return (stringToCheck.Equals(new string(rev), StringComparison.OrdinalIgnoreCase));}
How about:
 
public bool IsPalindrome(string stringToCheck)
{
    char[] rev = stringToCheck.Reverse().ToArray();
    return (stringToCheck.Equals(new string(rev), StringComparison.OrdinalIgnoreCase));
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ZamirF

United States United States
No Biography provided

Comments and Discussions

 
GeneralRe: Ah, you are correct. Thanks. PinprotectorAspDotNetDev5-Feb-11 19:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 7 Feb 2011
Article Copyright 2011 by ZamirF
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid