1. Insert a dash if there is not a fifth digit?

Hello All!
    I have several scripts written in Euphoria.  I have been playing
around with it to see if I have a field that holds a number and it has
only 4 digits to insert a dash in the middle, if it has 5 digits, leave
it alone.
    Does that sound possible?

Thanks for all the help

Bryan

new topic     » topic index » view message » categorize

2. Re: Insert a dash if there is not a fifth digit?

Phone number example

function insert_dash(sequence s)
  sequence temp

  if (find('-', s) = 0) and (length(s) = 7) then
    temp = s[1..3] & '-' & s[4..7]
  else
    temp = s
  end if

  return temp
end function


print(insert_dash("555-1234"))
print(insert_dash("5551234"))

        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Bryan <bmelugin at BELLSOUTH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, August 18, 1999 4:27 PM
Subject: Insert a dash if there is not a fifth digit?


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Bryan <bmelugin at BELLSOUTH.NET>
> Subject:      Insert a dash if there is not a fifth digit?
> --------------------------------------------------------------------------
-----
>
> Hello All!
>     I have several scripts written in Euphoria.  I have been playing
> around with it to see if I have a field that holds a number and it has
> only 4 digits to insert a dash in the middle, if it has 5 digits, leave
> it alone.
>     Does that sound possible?
>
> Thanks for all the help
>
> Bryan
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu