Piet Souris wrote:But first of all, clean the string from unwanted characters, like spaces, comma's Et cetera.
Robert D. Smith wrote:Why not something as simple as reversing a copy of the string, and then check if they are equal? Seems much simpler than running through a loop, counting characters, and such.
Stephan van Hulst wrote:... I would prefer the clearest solution:
How would you suggest one should reverse a String?
Robert D. Smith wrote:. . . reversing a copy of the string . . .
raghu kalachar wrote:
Below is my code.
Stephan van Hulst wrote:I know I've mentioned this before, but a friendly reminder that that code will only work for characters that fall within the Basic Multilingual Plane. In practice this probably isn't much of a problem...
They occur about every other week in the crossword puzzle. Spoonerisms are slightly less frequent. When I see phrases like, “both ways,” or, “up and down,” I can suspect the solution will be palindromic. Of course I only use the letters A...Z.
Junilu Lacar wrote:. . . Haven't run into a situation in real life where I actually need to check for palindromes. . . .
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database