Page 1 of 1

Convert IP Address to a String...NOOB

Posted: Thu Feb 28, 2008 4:57 am
by KidNovak
Yep I'm a NOOB.

I'm trying to convert an IP ADDRESS (ex. 10.10.10.10) to a String(ex. "10.10.10.10").


Thank you for the help.
Novak

Posted: Thu Feb 28, 2008 5:17 am
by SofT MANiAC

Code: Select all

Procedure.s ipAddressToString( ip.l)
  ipStr.s=""
  For i.l=0 To 3
    ipStr.s=ipStr.s+Str(IPAddressField(ip.l,i))+"."
  Next i
  ipStr.s=Left(ipStr.s,Len(ipStr.s)-1)
  ProcedureReturn ipStr.s
EndProcedure
This proc from CodeArhiv: Internet&Co/IP / IPCalculator.pb

Posted: Thu Feb 28, 2008 8:21 am
by maw
Or you simply use the builtin command :lol:

Code: Select all

ipaddress$ = IPString(IPAddress)

Posted: Thu Feb 28, 2008 11:48 am
by Num3
maw wrote:Or you simply use the builtin command :lol:

Code: Select all

ipaddress$ = IPString(IPAddress)
LOL :mrgreen: :mrgreen: :mrgreen: :mrgreen:

Posted: Thu Feb 28, 2008 1:54 pm
by KidNovak
Thanks for the Help.

I can't believe I missed "IPString" and "IPAddressField" in the Manual. :oops:
I went through all of the String commands and Math commands, but missed the IP commands.


I purchased Purebasic because it's great programming Language and this Forum is a Great help.

Thanks again,
Novak