converting phone numbers to alphabets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fo

    converting phone numbers to alphabets

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

    Thanks


  • michel

    #2
    Re: converting phone numbers to alphabets

    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" <somewhere@down under.com.au> wrote in message
    news:ccg40e$iav $1@otis.netspac e.net.au...[color=blue]
    > Does anyone know if there is a free code available to convert numbers to
    > text and/or text to numbers?
    >
    > Thanks
    >
    >[/color]


    Comment

    • Alvaro G Vicario

      #3
      Re: converting phone numbers to alphabets

      *** fo wrote/escribió (Wed, 7 Jul 2004 16:08:09 +1000):[color=blue]
      > Does anyone know if there is a free code available to convert numbers to
      > text and/or text to numbers?[/color]

      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_repl ace('[^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
      --

      Comment

      • Geoff Berrow

        #4
        Re: converting phone numbers to alphabets

        I noticed that Message-ID: <1ruuwzj34sjsy. 16eh22yempkml$. dlg@40tude.net>
        from Alvaro G Vicario contained the following:
        [color=blue]
        >Also, please note than handling phone numbers as text will remove leading
        >zeroes.[/color]

        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/

        Comment

        • Alvaro G Vicario

          #5
          Re: converting phone numbers to alphabets

          *** Geoff Berrow wrote/escribió (Wed, 07 Jul 2004 07:38:09 +0100):[color=blue][color=green]
          >>Also, please note than handling phone numbers as text will remove leading
          >>zeroes.[/color]
          >
          > Don't you mean 'handling phone numbers as numbers'.[/color]

          Yes, sorry.

          --
          --
          -- Álvaro G. Vicario - Burgos, Spain
          --

          Comment

          • fo

            #6
            Re: converting phone numbers to alphabets

            What I am looking for to more or less this

            "fo" <somewhere@down under.com.au> wrote in message
            news:ccg40e$iav $1@otis.netspac e.net.au...[color=blue]
            > Does anyone know if there is a free code available to convert numbers to
            > text and/or text to numbers?
            >
            > Thanks
            >
            >[/color]


            Comment

            • Chung Leong

              #7
              Re: converting phone numbers to alphabets

              "fo" <somewhere@down under.com.au> wrote in message
              news:ccg9qp$nc0 $1@otis.netspac e.net.au...[color=blue]
              > What I am looking for to more or less this
              > http://www.cheapnumbers.com/cgi-bin/spell.cgi
              > "fo" <somewhere@down under.com.au> wrote in message
              > news:ccg40e$iav $1@otis.netspac e.net.au...[color=green]
              > > Does anyone know if there is a free code available to convert numbers to
              > > text and/or text to numbers?
              > >
              > > Thanks[/color][/color]

              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.


              Comment

              • Geoff Berrow

                #8
                Re: converting phone numbers to alphabets

                I noticed that Message-ID: <ccg9qp$nc0$1@o tis.netspace.ne t.au> from fo
                contained the following:
                [color=blue]
                >What I am looking for to more or less this
                >http://www.cheapnumbers.com/cgi-bin/spell.cgi[/color]

                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/

                Comment

                • Markus Ernst

                  #9
                  Re: converting phone numbers to alphabets

                  "Chung Leong" <chernyshevsky@ hotmail.com> wrote

                  [...]
                  [color=blue]
                  > The trick I guess is finding conbination of words.[/color]

                  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((st rval($number), 1, ':');
                  $array = explode(":",$nu mber);
                  array_pop($arra y);

                  // 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


                  Comment

                  Working...