[Stackoverflow] [Progress OpenEdge ABL] Finding a "whole string" within a string with Index (or another way)?

Status
Not open for further replies.
F

Felice

Guest
I am reading in a list of constituent attributes (tags) and only want to keep a subset of them. Here is how I attempted to do that.

Code:
DEFINE VARIABLE tagsToKeep AS CHARACTER. 
    
tagsToKeep = "Business Contact,Celebrate 2015,Celebrate 2017,Celebrate 2019,Certificate - Former Holder,Non-MB Church".

/*do a bunch of stuff to get the cRecord which is one tag, often with spaces or other characters in it.*/

IF INDEX(tagsToKeep, cRecord) > 0 THEN 
            DO:
                CREATE ttTag.
                    ASSIGN 
                      ttTag.tag-code = cRecord         
                      ttTag.constituent-id = ttAccount.pin-string.  
                      ttTag.tag-name = cRecord.
            END.

The trouble is that one of the tags is "Certificate" which is a substring of one of the strings in the TagsToKeep string -- "Certificate - Former Holder" gets included and created as a Tag. I only want to match on the strings that are essentially "whole word only".

Is there a (better) way to do what I want to do?

Continue reading...
 
Status
Not open for further replies.
Top