Page 1 of 1 1
Topic Options
#118719 - 2004-04-28 11:50 AM IP address - HELP
dk_ecaspar Offline
Fresh Scripter

Registered: 2004-04-28
Posts: 6
Loc: Denmark
HI

Newbie to kix - but so far it looks GREEEAAATTTT......

I need help to derive a part of the IP address
eg 192.168.3.x

The value i need to put into a variable is the 3 (or whatever the value is)

I just cant't figure out how to.......

Hopefully one of you can help......

Top
#118720 - 2004-04-28 11:59 AM Re: IP address - HELP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Welcome,

try something like this :

$3rdOctett = val(trim(split(@ipaddress0,'.')[2]))
_________________________



Top
#118721 - 2004-04-28 12:02 PM Re: IP address - HELP
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Have a look (search) in the FAQ forums for more IP address help than you can shake a stick at.

Alternatively, go directly to the UDF forum and seach for IP/Subnet UDFs to do the job for you.

The quick anwer is:
Code:
$sThirdOctet=Trim(Split(@IPADDRESS0,".")[2])



However, I recommend that you look in the other forums for more info.

Top
#118722 - 2004-04-28 12:09 PM Re: IP address - HELP
dk_ecaspar Offline
Fresh Scripter

Registered: 2004-04-28
Posts: 6
Loc: Denmark
Hi again......and thanks...

Works like a charm....

one happy "dude"

Top
#118723 - 2004-04-28 04:18 PM Re: IP address - HELP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
J's example is better since it returns a value instead of a string. Could do without the trim() part (better golf score) though since Val() does that anyway.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2009 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org