symmetrical number- palindrome - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

symmetrical number- palindrome

Hi :)
I'm using delphi 7. I'm trying to make a progamme where i could check if number is palindrome (symmetrical ... for example 123 -isnt palindrome 2345432 - is palindrome).... (number input in edit1) and label say me (for example) 'yes this number is palindrome !' or 'no this number isnt palindrome') ... what i need is one edit, one button(all commands) and label ... this isnt hard to do (i know) but i am amateur and i need it a lot :) thx and sorry for my english... what i need is complete command for it .... muhuhee

Comments

  • DWDuckDWDuck Posts: 31Member
    The following function will help:

    Function ISPolindrome(Num:Integer): Boolean;
    Var
    J : Integer;
    Str1,Str2,Str3 : String;

    Begin
    Str(Str1,Num);
    Str2 := Copy(Str1,1,Length(Str1) div 2);
    Delete(Str1,1,Length(Str1) div 2);
    If Length(Str1)<>Length(Str2) then
    Begin
    Str3 := Str1[1];
    Delete(Str1,1,1);
    End;
    If Str1 = Str2 then
    TmpValue = True else TmpValue := False;

    IsPolinDrome = TmpValue;
    End;
    Darkwing Duck aka DWduck signing off :)
Sign In or Register to comment.