Re: Removing a character

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 27901
interpreted = N
texte = >A quick challenge to the WebCatalog Super Heroes out there: > >What is the smallest amount of code (please show) that you can write to >accomplish this simple task: > >You are given a database containing a field of data left padded by zeros >that you need to clean out. Example: > >Given -> What you want >----- ------------- >00B B >BLK BLK >BL0 BL0 >0BT BT >0Y0 Y0 > >Any quick ideas (looking for least processor intensive, and prefer to avoid >a lookup or looping convertchars)?There must be an easier way than this, but it's what I could come up with in 3 minutes. haven't tried it, hope it works.:[TEXT SHOW=F]GO=YES[/TEXT] [TEXT SHOW=F]STRING=[GIVEN][/TEXT][LOOP START=1&END=[COUNTCHARS][GIVEN][/COUNTCHARS]] [SHOWIF [GO]=YES] [SHOWIF [GETCHARS START=1&END=1][STRING][/GETCHARS]=0] [TEXT SHOW=F]STRING=[GETCHARS START=2][STRING][/GETCHARS][/TEXT] [/SHOWIF][SHOWIF [GETCHARS START=1&END=1][STRING][/GETCHARS]!0] [TEXT SHOW=F]GO=NO[/TEXT] [/SHOWIF] [/SHOWIF] [/LOOP][STRING]So, count the number of characters in [GIVEN]. Loop through and, it the iteration passes the [GO] test, lop off the first character if it's a 0. If it's not a 0, change the filtering variable ([GO]) to NO to prevent anything from happening in the rest of the iterations. There's actually a command to break the loop, but I don't remember it and it's not documented.Michael ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Associated Messages, from the most recent to the oldest:

    
  1. Re: Removing a character (Kenneth Grome 2000)
  2. Re: Removing a character (Rob Marquardt 2000)
  3. Re: Removing a character (Brian B. Burton 2000)
  4. Re: Removing a character (Michael Winston 2000)
  5. Re: Removing a character (Kenneth Grome 2000)
  6. Removing a character (Brian B. Burton 2000)
>A quick challenge to the WebCatalog Super Heroes out there: > >What is the smallest amount of code (please show) that you can write to >accomplish this simple task: > >You are given a database containing a field of data left padded by zeros >that you need to clean out. Example: > >Given -> What you want >----- ------------- >00B B >BLK BLK >BL0 BL0 >0BT BT >0Y0 Y0 > >Any quick ideas (looking for least processor intensive, and prefer to avoid >a lookup or looping convertchars)?There must be an easier way than this, but it's what I could come up with in 3 minutes. haven't tried it, hope it works.:[TEXT SHOW=F]GO=YES[/TEXT] [TEXT SHOW=F]STRING=[GIVEN][/TEXT][LOOP START=1&END=[countchars][GIVEN][/COUNTCHARS]] [SHOWIF [GO]=YES] [SHOWIF [GETCHARS START=1&END=1][STRING][/GETCHARS]=0] [TEXT SHOW=F]STRING=[GETCHARS START=2][STRING][/GETCHARS][/TEXT] [/SHOWIF][SHOWIF [GETCHARS START=1&END=1][STRING][/GETCHARS]!0] [TEXT SHOW=F]GO=NO[/TEXT] [/SHOWIF] [/SHOWIF] [/LOOP][STRING]So, count the number of characters in [GIVEN]. Loop through and, it the iteration passes the [GO] test, lop off the first character if it's a 0. If it's not a 0, change the filtering variable ([GO]) to NO to prevent anything from happening in the rest of the iterations. There's actually a command to break the loop, but I don't remember it and it's not documented.Michael ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Michael Winston

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:

Merging databases (1997) [ANN] GetRate 1.3 available (2000) How can I Add several Items into the cart at once? (1997) [dos] command question (1997) Help!!!! Purchases not going through! FIXED! (1997) Passing info in [Addlineitem] (1997) 3 card formulas! (1999) [WebDNA] calling a webDNA tmpl from PHP? (2008) WebDelivery downloads alias, not original ? (1997) New user...how do I create URLs from form fields? (2000) Searching Relational Databases (2004) Trouble with formula.db (1997) New index for docs (1997) [WebDNA] WebDNA 8.6 Ubuntu 16.04 (2018) Forms to db's and back (was Displaying text and (2005) [ot] ShowIf & HideIf Question (1998) MacFinder -- a new WebDNA web site (1998) Multiple catalog databases and showcart (1997) WebCat for mass emailings (1997) [WebDNA] Pretty URLS (2011)