| | |
palindrome
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
well, the following code should do it:
hope this helped
pygmalion
bool CheckPalindrome (string CheckString) { if (CheckString == null || CheckString.Length == 0) { return false; } for (int i = 0; i < CheckString.Length / 2; i++) { if (CheckString[i] != CheckString[CheckString.Length - 1 - i]) { return false; } } return true; }
hope this helped
pygmalion
You can try something like this
You have fun now
C# Syntax (Toggle Plain Text)
public static bool IsPalindrome(string strValue) { int intLen, intStrPartLen; intLen = strValue.Length - 1; //Cut the length of the string into 2 halfs intStrPartLen = intLen / 2; for (int intIndex = 0; intIndex <= intStrPartLen; intIndex++) { //intIndex is the index of the char in the front of the string //Check from behind and front for match if (strValue[intIndex] != strValue[intLen]) { return false; } //decrease the lenght of the original string to //test the next Char from behind intLen--; } return true; }
You have fun now
Delphi & C# programmer deluxe...
![]() |
Similar Threads
- To form a palindrome of a given string (C)
- Help on stack , queue, palindrome program... (C++)
- palindrome program (Legacy and Other Languages)
- stack palindrome problem? (C++)
Other Threads in the C# Forum
- Previous Thread: Simple Question??
- Next Thread: Combo Box
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array bitmap box broadcast buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms ftp function gdi+ httpwebrequest image index install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation visualstudio webbrowser windows winforms wpf xml






