Has anybody been able to code a generic-search-and-replace function ?
-* -* Replace occurances of P2 in P1 with P3 -* DEFINE FUNCTION SREPLACE/A255(P1 A255, P2 A255, P3 A255) ... ... END
I was about to implement it but fell short of how finding out syntax to write a loop in webfocus. I dont see in manuals how to write a loop. Any ideas ? I see that the DM kind of GOTO is not supported in functions.
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
April 21, 2006, 07:53 PM
Mikel
Working on WebFOCUS 7, we can use STRREP function:
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
April 27, 2006, 02:03 AM
Govind Jujare
I tested it just now on 5.3.3 and yes it worked. Thx for the tip. That helped me avoid a whole bunch of coding.
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
June 01, 2006, 11:55 PM
<Antony Gubert>
Hi,
I think that the above function work only when you know the length of each value of the string. What is the solution if I get a string as input and want to apply find and replace method. Please let me know.
Thanks
June 02, 2006, 12:12 AM
Govind Jujare
How about using LENGTH function to first find lengths ?
-SET &V1 = 'ABCDEFGH'; -SET &L1 = &V1.LENGTH;This message has been edited. Last edited by: Govind Jujare,
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
June 02, 2006, 06:44 AM
<JG>
What's actually interseting about the example is that the output is wrong.
When you use FTOA it left justifies the text it creates.
Also the substitution is invalid because all of the columns are not the same number of characters, so you end up with
USD 123456
USD 12345
If it was correctly justified it would look like
USD 123456
USD 12345
A floating $ is wrong, the example would only work if the format of the field is Dt.sN