473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

converting phone numbers to alphabets

fo
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks
Jul 17 '05 #1
8 5372
numbers to text is impossble, since per number, you have multiple letters.
letters to numbers would be an easy one to write yourself, wouldn't it?

Mich

"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks

Jul 17 '05 #2
*** fo wrote/escribió (Wed, 7 Jul 2004 16:08:09 +1000):
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?


As you as you use a numeric variable in a context that requires strings,
it's automatically converted. E.G:

<?
$foo=33;
echo "Foo=$foo";
?>

As about the opposite, you can use cast operators:

<?
$foo=(int)'33';
?>

Since phone numbers usually have dots, parenthesis and dashes, you should
remove them first. A simple regex will do:

<?
$foo=eregi_replace('[^0-9]+', '', '902-99 99 99'); // Untested!
?>

Also, please note than handling phone numbers as text will remove leading
zeroes.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #3
I noticed that Message-ID: <1r******************************@40tude.net>
from Alvaro G Vicario contained the following:
Also, please note than handling phone numbers as text will remove leading
zeroes.


Don't you mean 'handling phone numbers as numbers'.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
*** Geoff Berrow wrote/escribió (Wed, 07 Jul 2004 07:38:09 +0100):
Also, please note than handling phone numbers as text will remove leading
zeroes.


Don't you mean 'handling phone numbers as numbers'.


Yes, sorry.

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #5
fo
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks

Jul 17 '05 #6
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks


Not that I'm aware of. Shouldn't be too hard to code though. Just take a
word list, convert words with less than 7 letters to phone#, then insert
them into a hash table, something along the line of

array (
3456 => array('baby', 'dog', 'dingo'),
1234567 => array ( 'chicken', 'clinton', 'sweden' ... )
)

Serialize the hash table into a file. To retrieve a list of possible match,
just load the table and do a lookup. The trick I guess is finding
conbination of words. Should still be simply if you limit yourself to two
word conbinations.
Jul 17 '05 #7
I noticed that Message-ID: <cc**********@otis.netspace.net.au> from fo
contained the following:
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi


Ahhh..

tricky...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #8
"Chung Leong" <ch***********@hotmail.com> wrote

[...]
The trick I guess is finding conbination of words.


I think that's actually what the OP would like the script to do. Quite
tricky, maybe somehow like this:

// make array of digit's character values
$digits = array(array ("&amp", "@"), array("a", "b", "c"), array("d", "e",
"f"), ... );

// make array of number
$number = chunk_split((strval($number), 1, ':');
$array = explode(":",$number);
array_pop($array);

// Then make complex loops to make every possible combination of characters
and compare them with word list; I don't have the time to figure this out -
as the number length and thus the depth of loops vary it might be necessary
to use a function called for every digit of it.

--
Markus
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
4
by: Brian Henry | last post by:
I have phone numbers like this in a data table 123-435-1234 1231231234 432.234.2321 they all have different formatting, what I want to do is get them all formatted like this (123) 123-1234
10
by: JackM | last post by:
I'm still working on validating the phone numbers that are entered on a form but have come across a problem I don't understand how to fix. I can handle most instances when it's in regular US...
1
by: venu | last post by:
Hi, I have a different requirement and it is : I need to validate a phone number field. It may or may not be a US phone number. The constraints are : *********************** # It should...
3
by: venu | last post by:
Hi, I have a different requirement and it is : I need to validate a phone number field. It may or may not be a US phone number. The constraints are : *********************** # It should...
0
by: shara | last post by:
Hello there, Can anybody help me with this.I'm working on VB macros and i came across a situation where i have to convert numbers to column alphabets i.e....
5
by: lim4801 | last post by:
I am currently in doing a program which is given by my tutor: Contemplate that you are working for the phone company and want to sell "special" phone numbers to companies. These phone numbers are...
7
by: Propoflady | last post by:
My contacts can have as many as five or six phone numbers - is it possible to make a query that puts the name, and each phone number after it on the same line - for this reason I have two tables -...
7
by: prigupta2 | last post by:
i want to type Alphabets and numbers in text box in such a way first alphabets then number ex C102 M458 only CM0123456789 please provide code in vb6.0
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.