RE: Forcing Paragraph Breaks on Results - Yes you can replace String for String!

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 21877
interpreted = N
texte = Greetings,We use this to search a string for another string and replace with another string. To use, create 2 include files as follows:=== begin includes/replaceString.inc=== [math show=f]ilen=[countchars][sOriginal][/countchars][/math][text]sTmp=[/text][ma th show=f]iBInd=1[/math][math show=f]iEndx=1[/math][math show=f]iFlen=[countchars][sFind][/countchars][/math][loop start=1&end=[ilen]][math show=f]iEndx=[include file=includes/indexOf.inc&sOriginal=[sOriginal]&sFind=[sFind]&iStart=[iBInd] ][/math][showif [iEndx]=0][text]sTmp1=[sTmp][/text][math show=f]iIndx=[iBInd][/math][break][/showif][math show=f]iEndx2=[iEndx]-1[/math][text]sTmp=[sTmp][getchars start=[iBInd]&end=[iEndx2]][sOriginal][/getchars][sReplace][/text][math show=f]iBInd=iEndx+iFlen[/math][/loop][math show=f]iBInd=[ilen]+1[/math][showif [iIndx]<[iBInd]][text]sTmp1=[sTmp1][getchars start=[iIndx]&end=[ilen]][sOriginal][/getchars][/text][/showif][math show=f]iEndx=[include file=includes/indexOf.inc&sOriginal=[sOriginal]&sFind=[sFind]&iStart=1][/mat h][showif [iEndx]=1][text]sTmp1=[getchars start=2][sTmp1][/getchars][/text][/showif][sTmp1] ===end includes/replaceString.inc======begin includes/indexOf.inc=== [math show=f]sFindlen=[countchars][sFind][/countchars][/math][math show=f]slen=[countchars][sOriginal][/countchars][/math][math show=f]idx=0[/math][loop start=[iStart]&end=[slen]-[sFindlen]+1][showif [getchars start=[index]&end=[slen]][sOriginal][/getchars]~[sFind]][math show=f]idx=[index][/math][break][/showif][/loop][idx] ===end includes/indexOf.inc===Now call this include file from any .tpl that you want to srip as follows (of course you have to change the pathing to meet your needs):[include file=includes/replaceString.inc&sOriginal=The String you want to search through&sFind=String to Search For&sReplace=The string you want to replace]Here is what you are asking for I think:[include file=includes/replaceString.inc&sOriginal=User types in a sentence. Then another one.&sFind=. &sReplace=.

]This will result in the following string:User types in a sentence.

Then another one.Very useful for searching and replacing all kinds of stuff especially when you tie this to a database and perhaps spawn off work.We have a library of these kinds of functions to perform useful stuff which I have been meaning to prep and send to the ftp server. Maybe I'll get to it by Christmas.Aloha, Olin> -----Original Message----- > From: Kenneth Grome [mailto:ken@webdna.net] > Sent: Wednesday, December 16, 1998 11:26 AM > To: WebDNA-Talk@smithmicro.com > Subject: Re: Forcing Paragraph Breaks on Results > > > >>Can anyone think of a way to put (forced) paragraph breaks inside the > >>results of a search? > >>... searching for a particular string like .(space), then > >>adding an HTML

before continuing. > > >[ConvertChars][fieldName][/ConvertChars] will do what you want. > > > Hahaha! > > Good try, but convertchars will *NOT* do this. Convertchars only > works on ONE CHARACTER AT A TIME -- it cannot find two or more > characters and replace them. > > I've been asking for a simple string replacement feature since > the first beta of 2.x. But apparently it's no closer to being > implemented now than it was a year and a half ago. Nearly all > other database programs have this straightforward text > replacement capability, but webcat still does not. > > A long time ago, PCS found a way to make [boldwords] put > tags around a multi-character match string, so I see no reason > why they cannot use a similar technique to replace one match > string with a different string ... > > Sincerely, > Ken Grome > 808-737-6499 > WebDNA Solutions > mailto:ken@webdna.net > http://www.webdna.net > > > > Associated Messages, from the most recent to the oldest:

    
  1. RE: Forcing Paragraph Breaks on Results - Yes you can replace String for String! (Olin Lagon 1998)
Greetings,We use this to search a string for another string and replace with another string. To use, create 2 include files as follows:=== begin includes/replaceString.inc=== [math show=f]ilen=[countchars][sOriginal][/countchars][/math][text]sTmp=[/text][ma th show=f]iBInd=1[/math][math show=f]iEndx=1[/math][math show=f]iFlen=[countchars][sFind][/countchars][/math][loop start=1&end=[ilen]][math show=f]iEndx=[include file=includes/indexOf.inc&sOriginal=[sOriginal]&sFind=[sFind]&iStart=[iBInd] ][/math][showif [iEndx]=0][text]sTmp1=[sTmp][/text][math show=f]iIndx=[iBInd][/math][break][/showif][math show=f]iEndx2=[iEndx]-1[/math][text]sTmp=[sTmp][getchars start=[iBInd]&end=[iEndx2]][sOriginal][/getchars][sReplace][/text][math show=f]iBInd=iEndx+iFlen[/math][/loop][math show=f]iBInd=[ilen]+1[/math][showif [iIndx]<[iBInd]][text]sTmp1=[sTmp1][getchars start=[iIndx]&end=[ilen]][sOriginal][/getchars][/text][/showif][math show=f]iEndx=[include file=includes/indexOf.inc&sOriginal=[sOriginal]&sFind=[sFind]&iStart=1][/mat h][showif [iEndx]=1][text]sTmp1=[getchars start=2][sTmp1][/getchars][/text][/showif][sTmp1] ===end includes/replaceString.inc======begin includes/indexOf.inc=== [math show=f]sFindlen=[countchars][sFind][/countchars][/math][math show=f]slen=[countchars][sOriginal][/countchars][/math][math show=f]idx=0[/math][loop start=[iStart]&end=[slen]-[sFindlen]+1][showif [getchars start=[index]&end=[slen]][sOriginal][/getchars]~[sFind]][math show=f]idx=[index][/math][break][/showif][/loop][idx] ===end includes/indexOf.inc===Now call this include file from any .tpl that you want to srip as follows (of course you have to change the pathing to meet your needs):[include file=includes/replaceString.inc&sOriginal=The String you want to search through&sFind=String to Search For&sReplace=The string you want to replace]Here is what you are asking for I think:[include file=includes/replaceString.inc&sOriginal=User types in a sentence. Then another one.&sFind=. &sReplace=.

]This will result in the following string:User types in a sentence.

Then another one.Very useful for searching and replacing all kinds of stuff especially when you tie this to a database and perhaps spawn off work.We have a library of these kinds of functions to perform useful stuff which I have been meaning to prep and send to the ftp server. Maybe I'll get to it by Christmas.Aloha, Olin> -----Original Message----- > From: Kenneth Grome [mailto:ken@webdna.net] > Sent: Wednesday, December 16, 1998 11:26 AM > To: WebDNA-Talk@smithmicro.com > Subject: Re: Forcing Paragraph Breaks on Results > > > >>Can anyone think of a way to put (forced) paragraph breaks inside the > >>results of a search? > >>... searching for a particular string like .(space), then > >>adding an HTML

before continuing. > > >[convertchars][fieldName][/ConvertChars] will do what you want. > > > Hahaha! > > Good try, but convertchars will *NOT* do this. Convertchars only > works on ONE CHARACTER AT A TIME -- it cannot find two or more > characters and replace them. > > I've been asking for a simple string replacement feature since > the first beta of 2.x. But apparently it's no closer to being > implemented now than it was a year and a half ago. Nearly all > other database programs have this straightforward text > replacement capability, but webcat still does not. > > A long time ago, PCS found a way to make [boldwords] put > tags around a multi-character match string, so I see no reason > why they cannot use a similar technique to replace one match > string with a different string ... > > Sincerely, > Ken Grome > 808-737-6499 > WebDNA Solutions > mailto:ken@webdna.net > http://www.webdna.net > > > > Olin Lagon

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:

Admin Edit prob. (1997) A Global Variable (1997) Tiny Store / Checkboxes (1998) [WebDNA] DNA hosting and/or Image server Hosting. (2011) WebDNA 5.0 freeBSD?!!? (2003) Help! Error: Help! I'm stuck: Can't open order file. Ignoring [OrderFile] context (2000) Paging a SQL result... (2003) Strange Search Results (2004) BR (1997) Webstar 1.3.1 PPC (1997) WebDNA Payment Alternatives (2003) Re:E-Mailer (WebCatb15acgiMac) (1997) Storebuilder, Smith-Micro Tech Support (2000) Format of Required fields error message (1997) Who owns the code? (2002) text size limitation (1997) More on IE5 (2000) WebCatalog 2.0.1 NT beta 1 released (1997) CMS - Formatting Content (2004) WebCat2 - Getting to the browser's username/password data (1997)