Solved

Validation of postcode

Posted on 1998-03-18
4
319 Views
Last Modified: 2010-04-16
How do I validate a postcode using TPW v1.5.
I want it to be validated as I enter each character and if the character is not valid then it should not be printed to the screen.
0
Comment
Question by:McSpud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:Nanos
ID: 1217404
For this to work you must know the algorithm u want to check.. Then use a combination of "readkey" command, then show it using the write/writeln command.... readkey is a command is one of the headers, where it reads the entered valueinto a variable, without displaying it to the screen. If the variable matches certain criteria u can add it to a longer varible, and also show it on the screen!!
Hope it works for u!!
0
 

Expert Comment

by:Nanos
ID: 1217405
I'm not being pushy.. but at least tell me where I went wrong???
0
 
LVL 2

Accepted Solution

by:
omsec earned 20 total points
ID: 1217406
Hi

I'm npt familiar with TPW but in "normal" pascal (TP or BP) can you do that with a simple REPEAT - UNTIL - Loop  like this :

Program Test;

Uses
  Crt;   {or whatever in TPW}

Var
  KeyBoard  : Char;   {Get the key}

Begin
  Writeln;
  Writeln('hit keys as long you want to.');
  Writeln('''Q'', ''H'' and ''X'' will terminate program');
  Writeln;
  Repeat
    KeyBoard := ReadKey; {get key}
    KeyBoard := UpCase(KeyBoard); {make is caps}
    {do your wthings here}
    {all commands}
  Until (KeyBoard = 'Q') or (KeyBoard = 'H') or (KeyBoard = 'X');
End.

Hoping this could help, greets, Omsec :)
0
 

Author Comment

by:McSpud
ID: 1217407
Sorry Nanos, but I was really looking for a bit of code to get me started. Omsec's code is too basic but I have now figured it out using a case statement and adding a character if it fits an if statement. Thanks for taking time to answer my question.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article was originally published on Monitis Blog, you can check it  here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sour…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question