Re: Reversing [ipaddress] normalization
This WebDNA talk-list message is from 1998
It keeps the original formatting.
numero = 16645
interpreted = N
texte = This should work (you'll have to remove the carraige returns and spaces toget the output properly formatted):[math show=f]LastIsPeriod=1[/math][Loop start=1&end=15] [ShowIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=.] [math show=f]LastIsPeriod=1[/math] [/ShowIf] [ShowIf [math]LastIsPeriod[/math]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [/ShowIf] [ShowIf [math]LastIsPeriod[/math]=1] [HideIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [HideIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=.] [math show=f]LastIsPeriod=0[/math] [/HideIf] [/HideIf] [/ShowIf][/Loop]You can see it in action at http://www.digitalfrontier.com/test/stripzeros.htmlThis code could be easilly modified to handle other multiple-charactersubstitutions (or two-character substiutions, at least)-Dave>Date: 18 Mar 1998 21:38:16 -0800>From: Kenneth Grome
>Subject: Reversing [ipaddress] normalization>>How can I reverse the normalized [ipaddress] and put it back to the proper way>of writing IP addresses?>>I have to automatically submit many different ip addresses to a service via>WebCatalog form -- but the server I'm sending this data to does not accept>normalized WebCatalog IP addresses (with leading zeros where there were none>before) ...>>... so now I have to change them back from what WebCat does, and make them>into the same form that other Internet software expects to see them in. At>first I thought this would be easy using the new [convertchars] ...>>But I forgot that [convertchars] cannot handle more than ONE character in the>from field, so I cannot find the removeable zeros by replacing .0 with .>>Even that would require that I also look at the first two digits to see if one>or both are zeros, since they are not preceeded by a dot ... but I can handle>that, as long as the OTHER extra zero's are removed properly.>>So ... how can I do it?>>>Sincerely,>Ken Grome>808-737-6499>WebDNA Solutions>mailto:ken@webdna.net>http://www.webdna.neto--------------- Dave MacLeay --+o----------- Digital Frontier --+o--- dave@digitalfrontier.com --+
Associated Messages, from the most recent to the oldest:
This should work (you'll have to remove the carraige returns and spaces toget the output properly formatted):[math show=f]LastIsPeriod=1[/math][Loop start=1&end=15] [ShowIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=.] [math show=f]LastIsPeriod=1[/math] [/ShowIf] [ShowIf [math]LastIsPeriod[/math]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [/ShowIf] [ShowIf [math]LastIsPeriod[/math]=1] [HideIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [HideIf [interpret][GetCharsstart=[index]&end=[index]][ipaddress][/GetChars][/interpret]=.] [math show=f]LastIsPeriod=0[/math] [/HideIf] [/HideIf] [/ShowIf][/Loop]You can see it in action at http://www.digitalfrontier.com/test/stripzeros.htmlThis code could be easilly modified to handle other multiple-charactersubstitutions (or two-character substiutions, at least)-Dave>Date: 18 Mar 1998 21:38:16 -0800>From: Kenneth Grome >Subject: Reversing [ipaddress] normalization>>How can I reverse the normalized [ipaddress] and put it back to the proper way>of writing IP addresses?>>I have to automatically submit many different ip addresses to a service via>WebCatalog form -- but the server I'm sending this data to does not accept>normalized WebCatalog IP addresses (with leading zeros where there were none>before) ...>>... so now I have to change them back from what WebCat does, and make them>into the same form that other Internet software expects to see them in. At>first I thought this would be easy using the new [convertchars] ...>>But I forgot that [convertchars] cannot handle more than ONE character in the>from field, so I cannot find the removeable zeros by replacing .0 with .>>Even that would require that I also look at the first two digits to see if one>or both are zeros, since they are not preceeded by a dot ... but I can handle>that, as long as the OTHER extra zero's are removed properly.>>So ... how can I do it?>>>Sincerely,>Ken Grome>808-737-6499>WebDNA Solutions>mailto:ken@webdna.net>http://www.webdna.neto--------------- Dave MacLeay --+o----------- Digital Frontier --+o--- dave@digitalfrontier.com --+
Dave MacLeay
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
WebCat cannot handle compatible search parameters? (1997)
Date search and sendmail (1997)
[shell] (2002)
Next X hits (1996)
WebCat2 several catalogs? (1997)
many-to-one problem (1998)
WebDNA 4.5.1 on Tiger Server (2005)
WCS Newbie question (1997)
How To question on setting up downloads (1997)
Help Please WebDNA 6 Secure Forms Problem (2004)
Authenticate (1997)
Prices Dropped (1998)
listfiles, moving files (1998)
Here we go again... (2006)
Using Plug-In while running 1.6.1 (1997)
quotation marks needed? (2000)
Secure Server (1997)
Odd
If Empty ? (1997)
Security Tip (1996)