Mark,

It is not so hard.
Create a separate file called Replace.cmd 

Set up vtext, vfind, vrepl and run the the file.

Vtext will have been updated

Change vfind and vrepl and run the file again.

Repeat until done

Here's the code to put in Replace.cmd

SET VAR vPos INTEGER
SET VAR vLen INTEGER
SET VAR vPre TEXT
SET VAR vPost TEXT

SET VAR vPos = (SLOC(.vText,.vFind))
IF vPos > 0 THEN
  SET VAR vLen = (SLEN(.vFind))
  SET VAR vPre = (SGET(.vText,(.vPos-1),1))
  SET VAR vPost = (SGET(.vText,(SLEN(.vText)),(.vPos+.vLen)))
  SET VAR vText = (.vPre+.vRepl+.vPost)
ENDIF
RETURN





-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 3:20 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?

Dennis

Ouch!

I can see my toes but trying to touch them hurts.

It looks like I would have to do this code several times
in case I have    aaabcccbxxx  ?

Once I find some Advil I will give it a try.

Thanks
Marc






----- Original Message ----- 
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 2:41 PM
Subject: [RBASE-L] - RE: SRPL limit?


Marc,

Well it looks like you need a little stretching!
It doesn't hurt.

Put my code in a file and run it.

You will see the result = ac, b has been replaced with nothing


Try it with vRepl = a or b or c or x

You will see the results.

It is doing the SRPL the hard way, by grabbing the texts before and after 
the Find text and inserting the replace text between them.

Look up the functions I've used in help so you understand them.

Trace it and watch the variables.

I think you will get the idea

Dennis



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 2:25 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?

Dennis

Thanks for the code, sad to say you are still stretching me with that
example.
SRPL still seems much easier in my mind.

I will have to get a strong cup of coffee and study this some more.

Marc




----- Original Message ----- 
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 2:03 PM
Subject: [RBASE-L] - RE: SRPL limit?


Marc,

You can create your own custom functions for RBase to use.

Not withstanding that, here is some sample code on how work around the SRPL
problem. This method works whether your replacement value is null or not



SET VAR vTmp = 'abc' -- original text
SET VAR vFind = 'b' -- Text to find
SET VAR vRepl TEXT = NULL -- text to substitute

SET VAR vPos INTEGER
SET VAR vLen INTEGER
SET VAR vPre TEXT
SET VAR vPost TEXT

SET VAR vPos = (SLOC(.vTmp,.vFind))
IF vPos > 0 THEN
  SET VAR vLen = (SLEN(.vFind))
  SET VAR vPre = (SGET(.vTmp,(.vPos-1),1))
  SET VAR vPost = (SGET(.vTmp,(SLEN(.vTmp)),(.vPos+.vLen)))
  SET VAR vTmp = (.vPre+.vRepl+.vPost)
ENDIF


SHOW V vTmp
RETURN

Dennis McGRath

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 1:37 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?

Dennis

You and Larry are talking over my head and give me too much credit.

Marc

----- Original Message ----- 
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 1:15 PM
Subject: [RBASE-L] - RE: SRPL limit?


I think one of your best bets is to do as Larry suggested and make you own
function (stored procedure) that you can call.

I suspect someone on this list already has such a function written.

Dennis


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Monday, January 12, 2009 12:27 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SRPL limit?

Dennis

I thought of that but extra spaces would look bad in the paragraph.

It seems I can come up with some strange needs in my APP.

Marc


----- Original Message ----- 
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, January 12, 2009 12:16 PM
Subject: [RBASE-L] - RE: SRPL limit?


Bummer,

As far as I can tell, it has worked that way for some time.
It does limit the usefulness of this function quite a lot.

You could change himer to a space but that may not be what you want.

Dennis McGrath


Reply via email to