Solved

Validation of postcode

Posted on 1998-03-18
4
317 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE, DataSnap, JSon and java 8 1,033
Search the database TADOQuery and TVirtualStringTree 3 620
Embarcadero Interbase 9 753
Pass a string reference from one unit to another 8 114
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now