---
title: "How do you check if a given string is a palindrome?"  
description: "How do you check if a given string is a palindrome?"  
author: "Mukul Goenka"  
published: 2021-11-09  
updated: 2021-11-09  
canonical: https://www.mindstick.com/forum/156815/how-do-you-check-if-a-given-string-is-a-palindrome  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# How do you check if a given string is a palindrome?

How do you [check if](https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery) a given [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) is a palindrome?

## Replies

### Reply by Ravi Vishwakarma

## Program

```
using System;
class HelloWorld {
  static void Main() {
    HelloWorld hw = new HelloWorld();
    if (hw.IsPolindrom('12121'))
        Console.WriteLine('Is polindrom');
    else
        Console.WriteLine('Is not polindrom');
  }
  bool IsPolindrom(string str){
      char[] charArray = str.ToCharArray();
       Array.Reverse(charArray);
       return str.Equals(new string(charArray));
  }
}
```

## Output:

Is polindrom


---

Original Source: https://www.mindstick.com/forum/156815/how-do-you-check-if-a-given-string-is-a-palindrome

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
