Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Parsing hostnames

 [1/4] from: ptretter::charter::net at: 14-Oct-2000 13:33


How do you parse a hostname only to return the first portion. For example: hoststring: rebol.dyndns.org I would only want to return the portion up to the first "." which would be rebol in this case. Paul Tretter

 [2/4] from: mike:yaunish:home at: 16-Oct-2000 9:13


At 01:33 PM 14/10/00 -0500, you wrote: Try this:
>> hoststring: "rebol.dyndns.org"
== "rebol.dyndns.org"
>> first parse hoststring "."
== "rebol"
>> >How do you parse a hostname only to return the first portion. For example: > > hoststring: rebol.dyndns.org > >I would only want to return the portion up to the first "." which would be >"rebol" in this case. > >Paul Tretter
Mike Yaunish [mike--yaunish--home--com]

 [3/4] from: ptretter:charter at: 16-Oct-2000 10:53


Very cool. I didnt know you could use first in that manner.

 [4/4] from: brett:codeconscious at: 17-Oct-2000 10:51


Hi Paul, first is not doing anything unusual to what you probably expected. More likely you didn't realise what parse is doing:
>> hoststring: "rebol.dyndns.org"
== "rebol.dyndns.org"
>> parse hoststring "."
== ["rebol" "dyndns" "org"] Brett.