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 to get the output properly formatted): [math show=f]LastIsPeriod=1[/math][Loop start=1&end=15] [ShowIf [interpret][GetChars start=[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][GetChars start=[index]&end=[index]][ipaddress][/GetChars][/interpret]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [HideIf [interpret][GetChars start=[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-character substitutions (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:

    
  1. Re: Reversing [ipaddress] normalization (Michael Winston 1998)
  2. Re: Reversing [ipaddress] normalization (PCS Technical Support 1998)
  3. Re: Reversing [ipaddress] normalization (Michael Winston 1998)
  4. Re: Reversing [ipaddress] normalization (PCS Technical Support 1998)
  5. Re: Reversing [ipaddress] normalization (Dave MacLeay 1998)
  6. Reversing [ipaddress] normalization (Kenneth Grome 1998)
This should work (you'll have to remove the carraige returns and spaces to get the output properly formatted): [math show=f]LastIsPeriod=1[/math][Loop start=1&end=15] [ShowIf [interpret][GetChars start=[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][GetChars start=[index]&end=[index]][ipaddress][/GetChars][/interpret]=0] [GetChars start=[index]&end=[index]][ipaddress][/GetChars] [HideIf [interpret][GetChars start=[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-character substitutions (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:

AJAX with WebDNA (2006) Format of Required fields error message (1997) Some Advise needed (1997) [OT] Robust order processing (2003) [WebDNA] WebDNA 7 and Deprecated command (2011) Setting Cart value (2000) Web Delivery Page concept (1997) emailer setup (1997) What port is Email on ? (2000) multiple record replace (2001) MATH TIME (1997) system crashes, event log (1997) WebCat2b12 Mac.acgi--[searchstring] bug (1997) WSDL Wizard (2003) How to Display text in empty fields (1997) two unique banners on one page (1997) WebCat2 several catalogs? (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) Taget _top (2000) Can you do this??? and other stuff (1997)