Looking at the FAQ for IP Address Trimming we can do the simple code of -
code:
$1st=LTRIM(SUBSTR(@ipaddress0,1,3));#ip#
$2nd=LTRIM(SUBSTR(@ipaddress0,5,3));#ip# Get the IP# and assign it to $ipadr
$3rd=LTRIM(SUBSTR(@ipaddress0,9,3));#ip#
$4th=LTRIM(SUBSTR(@ipaddress0,13,3));#ip#
$ipadr='$1ST.$2ND.$3RD.$4TH';#ip#
Or, taking this to the next level -
code:
$1st=LTRIM(split(@ipaddress0,'.')[0])
$2nd=LTRIM(split(@ipaddress0,'.')[1])
$3rd=LTRIM(split(@ipaddress0,'.')[2])
$4th=LTRIM(split(@ipaddress0,'.')[3])
$ipadr='$1ST.$2ND.$3RD.$4TH' ; #ip#
But, wait there's more..
code:
DIM $i
FOR $i = 0 to 3
$ip=LTRIM(split(@ipaddress0,'.')[$i])
FOR EACH $i to UBOUND($i)
$ip+'.'
ENDIF
NEXT
The above does not work..
If we remove -
code:
DIM $i
FOR $i = 0 to 3
$ip=LTRIM(split(@ipaddress0,'.')[$i])
$ip+'.'
NEXT
It leaves a trailing ".".
Thanks,
Kent