Re: Ascii / Text Replacement / Substitution ?
Posted in 1997
You could do this in 4gl, but it would be slow. You really need a 'c' function to do this. It just so happens that an older and heavier contributor who has long since left us (Alan Popiel) wrote up a very nice translate function. You should be able to find it in the archives - if not holler and I'll try to dig it up. I seem to remember that it's called trans.c cheers j. At 01:07 AM 11/24/97 -0500, you wrote: }This one should be easy for you pros: } }In 4gl, I just need to replace (Like sed) characters within a string. }Specifically, I need to replace a certain 4 characters with another... } }ie. cData = "Freds Mom is dumb, really dumb" }How do I change cData to "Freds Mom is cool, really cool" } }Or, for a tougher example (The one i'm working on for a CGI project): }cData = "This is line 1\\r\\nThis is line 2\\r\\n\\r\\nThis is line 4" }I need to change that into: }"This is line 1<BR>This is line 2<BR><BR>This is line 4" } }I can insert the "<BR>" into the string fine, but I cant get rid of the }\\r or the \\n } }If possible, Id like to do this in 4gl, not with c } }Thanks in advance } }