dxl findPlainText check does not match string

874 Views Asked by At

I have a subroutine that I pass a string value from a skip list. That value is compared to objects in a Doors File. But the comparison does not work.

Skip split (string s, string delim)
{
   Skip skp = create
   int i = 0
   Regexp split = regexp "^(.*?)" delim "(.*)$"
   while (split s)
   { 
      string temp_s = s[match 2]
      put(skp, i++, s[match 1] "")
      s = temp_s
   }
   put(skp, i++, s "")
   return skp
}

string getInfo( string inStr)
{
   for currObj in currMod do
   {
      if ( findPlainText( ( currOBJ.SW_VRC ""), inStr, offsetFromFind, lengthFromFind, false ) )
      {
         print currOBJ.SW_VRC " matches " inStr "\n";
      }
    }
}

Skip newLst = split(modname, ",")  // this just splits a string input into parameters separated by commas

string inputInfo;

find(newLst, 0, inputInfo)

getInfo(inputInfo)

Now this is a simplified version of what I am doing. But the findPlainText does not match anything. inputInfo is getting the correct string, I checked. The part that really kills me is if I hardcode in the parameter

i.e. inStr = "21";

It works like it's supposed to. Now I was assuming a string is a string. Is there a difference between a string from a skip list and a string that's quoted? Is there a hidden character? What am I missing? Any insight you could provide would be welcome.

Thanks, DevM

1

There are 1 best solutions below

2
On

your snippet works, but I had to add some variables to make it work, and I don't have a split function at hand:

Skip split (string s, string delim)
{
   Skip skp = create
   int i = 0
   Regexp split = regexp "^(.*?)" delim "(.*)$"
   while (split s)
   { 
      string temp_s = s[match 2]
      put(skp, i++, s[match 1] "")
      s = temp_s
   }
   put(skp, i++, s "")
   return skp
}
string SW_VRC="Object Text"
Module currMod = current Module
string getInfo( string inStr)
{
   int offsetFromFind, lengthFromFind
   string resultString = "" 
   Object currObj
   for currObj in currMod do
   {
      if ( findPlainText( ( currObj.SW_VRC ""), inStr, offsetFromFind, lengthFromFind, false ) )
      {
         print currObj.SW_VRC " matches " inStr "\n";
         resultString = resultString "\n" currObj.SW_VRC ""
      }
    }
    return resultString
}
string modname = "a,b,cc,ccc,d,e,f"
Skip newLst = split (modname,",")

string inputInfo= "";

find(newLst, 0, inputInfo)

getInfo(inputInfo)

Perhaps you removed too much information when preparing this post? Or you don't have an entry with the key "0" in newLst? What happens if you start your function with

string inputInfo
inputInfo = "21"
getInfo (inputInfo)

?