Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The Conversation Pit > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
Thread Tools
Old 05-05-2008, 07:25 AM   #1 (permalink)
Registered User
 
Join Date: May 2008
Posts: 1
OS: Xp


Ada Type checker

Quick question, I have a program that needs to check if a character read into it is part of the alphabet. Now I know I could do this using a list of the alphabet and using a function to check that list a return a boolean value (but this method is ugly and slow). So I thought I could make a subtype i.e. subtype valid_letter is Character Range 'a'..'z';

I was wondering if anyone knew a way to check this in an if statement

i.e. if X = 'a' then,

but replacing the 'a' with "is part of type valid_letter".

Thanks in advance.
nanaman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 05-06-2008, 06:25 AM   #2 (permalink)
Registered User
 
Join Date: Jul 2007
Posts: 459
OS: Win Vista Home Premium


Re: Ada Type checker

Hey sorry but i dont know the language you're using...

But....Could it be compared with an integer (which represents the letter) e.g. if X = 1 (representing 'a') or could you use an integer and convert it into a character for the check...

e.g. if X = Char(1); sorry this wont be in any way accurate, but data conversion between ordinal types (integer and character) should be easy?

if theres a char function then you could use a for loop then use the char function to check each digit (though it would probably be ascii so 1 would not be a etc)...

Hope any of this helps,
Jamey
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 05:22 AM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81