Palindrome Program

Damatrix
10-31-2002, 10:06 PM
hi is there anyways to create a palindrome program

eg.

MOM is a palindrome
the eHt is also
howdy is not

you get what i mean???
hope so try your best i need it for my rpg
:(

AutoCOL
10-31-2002, 10:18 PM
well, i suppose a way to do it would be... find the length of the string that you're analysing using the Len function.

then, using the Left and Right functions, grab the first and last letter and compare them. if they're the same, use Left and Right again to compare the next two letters, etc, until you either have a mismatch, or there a no letters left.

if there's an odd number of letters you obviously don't have to analyse the central letter.

here's a big one for ya -

A MAN, A PLAN, A CANAL - PANAMA!

if you wanted your program to analyse that, you would obviously have to have it remove the spaces and punctuation...

HTH.

Col.

Robby
10-31-2002, 10:21 PM
With a simple search, you would've found the fastest palindrome algorithms in the world, YES the world. Here are some of our contest winners...
http://www.visualbasicforum.com/showthread.php?s=&threadid=30946&highlight=palindrome

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum