` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Functions: Replace function
2004-06-04 -- Jonathan Kay
 
Newsgroups: comp.lang.clarion > I need a procedure something like this > ReplaceString(BigTextString,FindString,ReplaceString), where it looks for > the FindString and replaces it with ReplaceString in the BigTextString. I'd be inclined to do away with the 'BigString'; there may be times you don't know how big to make it. Here's what I use - just prototype to return a STRING: Replace PROCEDURE(STRING Text,STRING Find,STRING Replace,BYTE CS=FALSE) Pos UNSIGNED,AUTO RVal ANY ! Do not add ,AUTO CODE LOOP Pos = CHOOSE(~CS,INSTRING(UPPER(Find),UPPER(Text),1),INSTRING(Find,Text,1)) RVal = RVal & CHOOSE(~Pos,Text,Text[1 : Pos-1] & Replace) Text = CHOOSE(~Pos,'',Text[Pos+LEN(Find) : LEN(Text)]) UNTIL ~Text RETURN RVal Jon.


Today is May 2, 2024, 2:57 am
This article has been viewed 35118 times.
Google search has resulted in 12 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: