Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
number analysis algorithm

Posted by nano (nano), 7 July 2006
Hi guys ,

Trying to write  some c code to do some number analysis  for example with ph. nos trying to manipulate if the  number is from it's home country or if its a free phone number oran international number ..

Any ideas how one might implement this through C ?

-your help is appreciated

nano

Posted by admin (Graham Ellis), 9 July 2006
I've done something just like this, though my language of choice at the time was Perl rather than C. I note you've previously posted to the Perl boards .. and I do think that would be a much better choice for you, although I don't know whether this request comes as part of a bigger project where there's good reason to use C?

In C, as in any language, I would start off by normalising my user's input - stripping out spaces, replacing initial string convernions such as "+" and "(0)" with what they mean when dialled locally.  

Second stage ... a match against a file of possible start sequences such as the one we have in our data library - see stdcodes.xyz -  using the C regular expression library.

Posted by nano (nano), 10 July 2006
Thanks for that - I will be writing in C++  as it's part of a proj.   Firstly i guess I will read table which defines all the countrycodes / area codes into a series of hash tables where the hashkey will be the CountrycodeAreaCode combined.

Have you done similar to this ?

thanks again.
Nano

Posted by admin (Graham Ellis), 11 July 2006
I don't think that having keys of a hashtable is going to make it particularly searchable when you want to look for numbers starting with a certain sequence ... that's why I used regular expressions.   Yes, I have done similar, but my requirement was to find a practical solution to a need rather than as a project / learning exercise.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho