Solved

Validation of postcode

Posted on 1998-03-18
4
320 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Make the most of your online learning experience.
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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