?
Solved

Validation of postcode

Posted on 1998-03-18
4
Medium Priority
?
322 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
The Summer 2017 Scholarship Winners have been announced!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

771 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