| Name | Modified | Size | Downloads / Week | 
|---|---|---|---|
| Parent folder | |||
| editstring.c | 2019-06-13 | 2.0 kB | |
| readme.txt | 2019-06-13 | 1.2 kB | |
| Totals: 2 Items | 3.2 kB | 0 | |
Subject: Re: 4GL "replace" function
Date: Fri, 11 May 2001 16:23:08 -0700 (PDT)
From: Jonathan Leffler <jleffler@informix.com>
To: IIUG Software Archive <software@iiug.org>,
     Informix NewsGroup <informix-list@iiug.org>
On Fri, 11 May 2001, Ed Brown wrote:
>Has anyone ever coded/seen/used a C-code function for 4GL that can replace
>text within a string? Something like:
>
>LET string1 = REPLACE (source_string, search_for, replace_with)
>
>so that:
>
>LET string1 = REPLACE ("ABCDEFG", "CD", "XYZ")
>
>would result in string1 having a value of "ABXYZEFG"
>
>I looked on the IIUG site and didn't see anything in the software
repository
>there.
The attachment contains a global search and replace I wrote and used a
long time ago.  It translates "ABCDEFGCDHIJKLCDMN" to
"ABXYZEFGXYZHIJKLXYZMN", and apart from the name matches your calling
semantics.
It's still in K&R C because it pre-dates the original C standard.
However, I see that the compiler I used did have some support for
'void'.  That was probably on SCO Xenix.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
     "I don't suffer from insanity; I enjoy every minute of it!"